4.3 Handling of continuation lines

Organization of this section
(1) SQL other than CREATE PROCEDURE, CREATE FUNCTION, CREATE TYPE, or CREATE TRIGGER
(2) CREATE PROCEDURE, CREATE FUNCTION, CREATE TYPE, and CREATE TRIGGER
(3) EOF detected in an SQL statement

(1) SQL other than CREATE PROCEDURE, CREATE FUNCTION, CREATE TYPE, or CREATE TRIGGER

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.

Example

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.

(2) CREATE PROCEDURE, CREATE FUNCTION, CREATE TYPE, and CREATE TRIGGER

The table below 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 the table, 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 specifiedSpecified
CREATE PROCEDUREEND_PROC;END_PROC;
CREATE FUNCTIONEND_PROC;END_PROC; or END_FUNC;
CREATE TYPEEND_PROC;END_PROC; or END_TYPE;
CREATE TRIGGEREND_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.

Example

CREATE PROCEDURE P1                        (Continued)
BEGIN                                      (Continued)
 INSERT INTO INTO T1(C1) 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.

(3) EOF detected in an 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.

Example

CREATE TABLE T1(C1 INT,             (Continued)
               C2 CHAR(10)         (Continued)
EOF                                 (End of command)