SQL/MP Programming Manual for COBOL85

Data Retrieval and Modification
HP NonStop SQL/MP Programming Manual for COBOL85429326-004
4-6
Using IN SHARE MODE or IN EXCLUSIVE MODE
FROM PERSNL.EMPLOYEE
WHERE EMPLOYEE.EMPNUM = :FIND-THIS-EMPLOYEE
END-EXEC.
Using IN SHARE MODE or IN EXCLUSIVE MODE
If you include the keyword IN in the EXCLUSIVE MODE or SHARE MODE option after
a host variable, the statement generates a syntax error. For example, this statement
generates a syntax error because HOST-VAR IN EXCLUSIVE MODE is interpreted as
a host variable:
EXEC SQL SELECT COLUMN INTO :HOST-VAR FROM ATABLE
WHERE COLUMN > :HOST-VAR IN EXCLUSIVE MODE END-EXEC.
To prevent the syntax error, omit the keyword IN:
EXEC SQL SELECT COLUMN INTO :HOST-VAR FROM ATABLE
WHERE COLUMN > :HOST-VAR EXCLUSIVE MODE END-EXEC.
INSERT Statement
The INSERT statement inserts one or more rows into a table or protection view. To
insert data, a program moves the new data to a series of host variables and then
executes an INSERT statement to transfer the host variable values to the table.
To execute an INSERT statement, a program’s PAID must have read and write access
to the table or view receiving the data and read access to tables or views you include
in a SELECT statement.
SQL/MP returns these values to SQLCODE after an INSERT statement.
If an INSERT statement executes successfully, the SQLCA structure contains the
number of rows inserted. (If the INSERT statement fails, do not rely on the SQLCA
structure for an accurate count of the number of rows inserted.) To return the contents
of the SQLCA structure, use the SQLCA_DISPLAY2_ or SQLCA_TOBUFFER2_
procedure.
For more information, see Section 5, SQL/MP System Procedures
, and Section 9,
Error and Status Reporting.
SQLCODE Value Description
0
The INSERT statement was successful.
100
No rows qualified for an INSERT using a SELECT statement
specification.
< 0
An error occurred; SQLCODE contains the error number.
> 0 (not 100)
A warning occurred; SQLCODE contains the first warning number.