NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
S-75
Static SQL
Static SQL
Static SQL is a form of embedded SQL in which SQL statements are coded directly into
a host language source program.
Static SQL statements begin with EXEC SQL and end with one of the following
statement terminators:
Unlike dynamic SQL statements, which can be constructed during program execution,
static SQL statements must be coded directly in the host language program before
compilation.
You can code static SQL statements to refer to different data bases during different
executions by specifying table and view names with DEFINEs and using CONTROL
QUERY to request execution-time name resolution, but the SQL statements themselves
remain unchanged (“static”) from execution to execution.
For more information about using static SQL, see the NonStop SQL/MP programming
manual for one of the host languages.
LOCK TABLE
Statement
Locks a table (or the underlying tables of a view) and associated
indexes
OPEN Statement * Opens a cursor
PREPARE Statement Compiles a DDL, DML, DCL, or DSL statement for later
execution by EXECUTE
RELEASE Statement * Deallocates memory for a dynamic SQL statement referred to
through a host variable
ROLLBACK WORK
Statement
Undoes all database modifications made to audited objects during
the current TMF transaction and releases all locks held by the
transaction
SELECT Statement Retrieves data from tables and views
SQL Directive Indicates to a host language compiler that a program contains SQL
statements
UNLOCK TABLE
Statement
Releases locks held on nonaudited tables or views
UPDATE Statement Updates values in columns of a table or view
UPDATE STATISTICS
Statement
Updates statistics about the contents of a table and its indexes
WHENEVER
DIRECTIVE *
Specifies action to take when errors, warnings, or no-row-found
conditions occur in a program
; occurs in C, Pascal, and TAL programs
END-EXEC. occurs in COBOL85 programs
* Can be used only in program