Entering content frame

 Conventions for the Order of SQL Statements 

When the precompiler runs with the precompiler option check, it runs once, sequentially, through the source code of the application program, and sends any static SQL statements that it finds to the database kernel . So that the check can run correctly, the embedded SQL statements must appear in an executable order in the source code.

Observe the following conventions when you embed SQL statements.

·        CREATE TABLE comes before INSERT, UPDATE, DELETE, and SELECT.

·        INSERT, UPDATE, DELETE, and SELECT come before DROP TABLE.

·        SELECTcomes before FETCH. It must be possible to make a unique assignment between the SELECT statement and the FETCH statement.

·        DECLARE CURSOR comes before OPEN.

·        OPENcomes before FETCH.

·        FETCHcomes before CLOSE.

The process flow of the program solely is responsible for the order in which the SQL statements are actually executed at runtime of the program.

The precompiler does not send dynamic SQL statements to the database, since their content is unknown before runtime.

 

Leaving content frame