SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
5-1
5
Simple and Compound Statements
You can access data in an SQL database without a cursor by using simple SQL/MX
Data Manipulation Language (DML) statements:
To enable clients to batch multiple SQL statements into one data request to the server,
NonStop SQL/MX extends simple DML statements to allow for compound statements,
including the assignment statement and the IF statement:
This section describes these two types of statements and also describes PROTOTYPE
host variables, which you can use as table names to enable late name resolution for
the SQL statements in your program. See Using PROTOTYPE Host Variables as Table
Names on page 5-17.
Simple DML Statement Description
Single-Row SELECT Statement
Retrieves a single row (or rowset) from a table or view
and places the specified column values in host
variables. With a cursor, use the DECLARE CURSOR
declaration and the FETCH statement.
INSERT Statement
Inserts one or more rows into a table or view. Use for
all INSERT operations.
Searched UPDATE Statement
Updates the values in one or more columns in a single
row or a set of rows of a table or view. With a cursor,
use the positioned UPDATE statement.
Searched DELETE Statement
Deletes a single row or a set of rows from a table or
view. With a cursor, use the positioned DELETE
statement.
Compound DML Statement Description
Compound Statements
Specifies that the BEGIN and END keywords bracket a
sequence of SQL statements that must be executed as
a single SQL statement. Cannot contain C/C++ or
COBOL commands.
Assignment Statement
In the context of a compound statement, the values
computed or set by one SQL statement can be used by
subsequent SQL statements within that compound
statement.
IF Statement
In the context of a compound statement, provides
conditional execution of SQL statements.