Enter SQL statements in this window, observing the rules and restrictions described below.
To execute the SQL, select the Go or Execute one button.
Rules and restrictions
-
To commit your work, you must explicitly include a COMMIT statement or select the Use autocommit checkbox. The Interactive SQL function does not execute a COMMIT WORK after each statement execution. However, an automatic COMMIT WORK is performed when the connection is closed. If you do not want your work committed when you close the interactive SQL window, you must explicitly include ROLLBACK WORK.
-
All SQL statements in the window (either entered directly or read in from a file) must have the first two words on the same line.
-
If a SELECT statement contains embedded SELECTs, do not place the word SELECT from any embedded SELECT as the first word on a line (it will be taken as a new statement).
-
In an ALTER FILESPACE statement, place a DROP FILE clause on the same line as the ALTER instead of on a separate line.
A CREATE VIEW statement is allowed to have the word SELECT as the first word of a line (it is treated as a special case). Consequently, however, the first SELECT on the line following CREATE VIEW is treated as part of the CREATE VIEW (unless some other SQL statement delimits the end of the CREATE VIEW).
For example, the following statements are considered to be a single SQL CREATE VIEW statement:
CREATE VIEW TABLE_ABC AS
SELECT BAR FROM TABLE_ABC
SELECT SOMETHING FROM ANOTHER_TABLE
To avoid this problem, insert a COMMIT WORK statement before a SELECT statement that follows a CREATE VIEW statement.
-
In general, the cursor may be placed on any line of an SQL statement, and the parser will scan backwards to determine the beginning of the SQL statement and then forwards to determine the end of the SQL statement.
-
In general, if the parser does not recognize a statement specific to a particular DBMS, you can successfully submit the statement if it is the only statement in the window.