SET TERM
SET TERM new_terminator current_terminator
This command changes the statement terminator as defined by the provided string.This is mostly useful when you are about to enter a string of SQL statements making up a procedure, for example, or a trigger.With the default terminator, ;
, isql
would attempt to execute each statement when it sees a terminating semicolon, and given PSQL internally also uses semicolons, this would result in incomplete statements being executed.You need to change the terminator first, then enter the required code.When complete, you can change it back, but when doing so, you must remember to terminate the set term
command with the current terminating character(s).
When first started, isql
uses the semicolon (;
) as the default terminator.
You can, if desired, simply change the terminator because you prefer something other than a semicolon.You don’t have to be writing PSQL code to change it.
SQL> -- Change terminator from ; to + SQL> set term +; SQL> select count(*) from employee+ COUNT ============ 42 SQL> -- Change terminator from + to 'fred' SQL> set term fred + SQL> select count(*) from employee fred COUNT ============ 42 SQL> -- Change back from 'fred' to ; SQL> set term ; fred
See the section on the terminator for full details.