NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
I-18
Examples—INSERT
Buffering insert operations
To allow VSBB for insert operations for a nonaudited file, use the CONTROL
TABLE directive with SEQUENTIAL INSERT ON, SYNCDEPTH 0, and TABLE
LOCK ON options. Additionally, specify FOR REPEATABLE ACCESS in your
INSERT statement and specify IN EXCLUSIVE MODE in the LOCK TABLE
statement.
See CONTROL TABLE Directive
on page C-72 for information on buffering
INSERT operations.
Host-program status reporting
In host programs, status for INSERT operations is reported to the SQLCODE
variable in the SQLCA as follows:
Some error/warning codes have both a positive and a negative version because the
problem described by the associated message causes an error in some situations and
a warning in others.
The SQLCA also records the number of rows inserted.
Examples—INSERT
The following example inserts a row into the CUSTOMER table and supplies the
value “A2” for the CREDIT column:
INSERT INTO SALES.CUSTOMER ( * )
VALUES (4777, "ZYROTECHNIKS", "11211 40TH ST.",
"BURLINGTON", "MASS.", "01803", "A2" );
The following example also inserts a row into the CUSTOMER table. Unlike the
previous example, this INSERT does not include a value for the CREDIT column,
which has a default value. As a result, this INSERT must include the column name
list.
INSERT INTO SALES.CUSTOMER
(CUSTNUM, CUSTNAME, STREET, CITY, STATE, POSTCODE)
VALUES (1120, "EXPERT MAILERS", "5769 N. 25TH PLACE",
"PHOENIX", "ARIZONA", "85016");
< 0 An error code number
0 INSERT was successful
> 0 A warning code number
100 No rows qualify for an INSERT through a SELECT