SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
I-18
Examples—INSERT
For information on buffering INSERT operations, see CONTROL TABLE Directive 
on page C-77.
In host programs, status for INSERT operations is reported to the SQLCODE 
variable in the SQLCA:
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
This 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" );
This 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");
This example inserts a DATETIME value into the TIME_SHIPPED column:
INSERT INTO SHIPMENTS (TIME_SHIPPED)
 VALUES ( DATETIME "1988-10-22:08:15" YEAR TO MINUTE );
This example inserts a DATE value into the BIRTHDATE column of the 
PERSONNEL table:
INSERT INTO PERSONNEL (BIRTHDATE)
 VALUES ( DATE "1940-10-09" );
This example inserts DATETIME and INTERVAL values:
INSERT INTO PROJECTS
 VALUES ("945", DATETIME "1989-10-20" YEAR TO DAY,
 DATETIME "1990-10-21" YEAR TO DAY,
 INTERVAL "30" DAY);
< 0  An error code number
0 INSERT was successful
> 0 A warning code number
100 No rows qualify for an INSERT through a SELECT










