SQL Programming Manual for Pascal
NonStop SQL Statements and Directives
HP NonStop SQL Programming Manual for Pascal—528614-001
3-19
INSERT and Access
available. If you specify APPEND instead of ANYWHERE, the row is added to the end
of the table.
The SQLCODE values that NonStop SQL returns after an INSERT statement are:
INSERT and Access
To execute an INSERT statement, a program's process accessor ID (PAID) must have
read and write access to the table or view receiving the data and read access to tables
and views if you use a SELECT statement parameter.
Inserting a Scaled Value
To insert a value with scale (for example, a price) into the database, use a host
variable of INT32 Pascal data type or use the SETSCALE function to specify the scale
to SQL.
Inserting a Null Value
The following example inserts an employee record into the EMPLOYEE table and sets
the SALARY column to a null value. This example assumes you have specified the
following DEFINE for the EMPLOYEE table:
SET DEFINE CLASS MAP
ADD DEFINE =EMPLOYEE, FILE \SYS1.$VOL1.PERSNL.EMPLOYEE
...
{ Variable declarations: }
...
EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL INVOKE PERSNL.EMPLOYEE AS EMP_TBL_TYPE;
{ The invoked TYPE definition is: }
{ TYPE }
{ EMP_TBL_TYPE = RECORD }
{ EMPNUM : CARDINAL; }
{ FIRST_NAME : FSTRING(15); }
{ LAST_NAME : FSTRING(20); }
{ DEPTNUM : CARDINAL; }
{ JOBCODE : CARDINAL; }
Value Meaning
0 The INSERT statement was successful.
100 No rows qualified for an INSERT through a SELECT specification.
< 0 An error occurred; SQLCODE contains the error number.
> 0 (not 100) A warning occurred; SQLCODE contains the first warning number.