If a line ends with a semicolon (;), the system treats the line of code as one SQL statement (the system ignores any space or control character following the semicolon). A line that does not end with a semicolon is assumed to be continued on the next line.
CREATE TABLE T1 (C1 INT, (Continued)
C2 CHAR(10), (Continued)
C3 CHAR(10)); (End of SQL statement)
If a line ends with a semicolon that is enclosed in double quotation marks ("), the system treats it as the end of the SQL statement.
Table 4-1 shows the handling of continuation lines with CREATE PROCEDURE, CREATE FUNCTION, CREATE TYPE, and CREATE TRIGGER. If a line ends with a character string indicated in Table 4-1, the system treats the line of code up to that character string as an SQL statement (the system ignores any space or control character following the semicolon).
Table 4-1 Handling of continuation lines with CREATE PROCEDURE, CREATE FUNCTION, CREATE TYPE, and CREATE TRIGGER
SQL statement | -e option | |
---|---|---|
Not specified | Specified | |
CREATE PROCEDURE | END_PROC; | END_PROC; |
CREATE FUNCTION | END_PROC; | END_PROC; or END_FUNC; |
CREATE TYPE | END_PROC; | END_PROC; or END_TYPE; |
CREATE TRIGGER | END_PROC; | END_PROC; or END_TRIG; |
The system assumes that CREATE PROCEDURE, CREATE FUNCTION, CREATE TYPE, or CREATE TRIGGER is continued on to the next line, even if it ends with a semicolon.
CREATE PROCEDURE P1 (Continued)
BEGIN (Continued)
INSERT INTO VALUES(10); (Continued)
UPDATE T1 SET C1 = 0 WHERE C1 < 0; (Continued)
END (Continued)
END_PROC; (End of SQL statement)
If a line ends with END_PROC; that is, enclosed in double quotation marks ("), the system treats it as the end of the SQL statement.
If the system detects EOF in an SQL statement (before detecting a semicolon), the system treats it as the end of the SQL statement and executes the SQL statement read so far.
CREATE TABLE T1(C1 INT, (Continued)
C2 CHAR(10) (Continued)
EOF (End of command)