SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
I-15
INSERT Statement
the columns, and specify values of appropriate type and size for the 
corresponding columns.
val
is a host variable, a literal, an expression, a parameter name, or the keyword 
NULL (representing a null value) that specifies a value. val cannot include a 
column reference.
select-stmt
specifies a select operation that selects values from other tables or views to insert 
in name. It has the syntax of a SELECT statement (see SELECT Statement on 
page S-18) with these restrictions:
The select list must contain an element for each column specified on the 
INSERT statement.
The SELECT cannot include a subquery that refers to a table, view, or 
underlying table of the view into which rows are being inserted.
The SELECT cannot use the INTO clause.
You must enclose the select-stmt in parentheses if it includes an access 
mode. The access mode applies only to rows compared to the selection criteria 
(in this case, even if the rows are in an audited table).
If select-stmt returns no rows, no rows are inserted. (Note that this contrasts 
with the behavior for subqueries in comparison predicates. For subqueries, if no 
values are returned, SQL returns a null value.)
[ FOR ] { STABLE | REPEATABLE } ACCESS
specifies STABLE or REPEATABLE access mode. STABLE is the default. (For 
more information, see Access Options
 on page A-1.)
RETURNING { :host-var }
 { LASTSYSKEY}
 { ?param }
directs SQL to return the value of the SYSKEY for the last record inserted. (Applies 
only in host programs that INSERT into tables or views with a SYSKEY column.)
For static SQL programs, :host-var specifies a host variable to receive the 
SYSKEY. For dynamic SQL programs, LASTSYSKEY specifies a place holder to 
store the SYSKEY.
?param is the name of a parameter that has the same function as LASTSYSKEY 
and is included to maintain compatibility with existing programs. Use 
LASTSYSKEY instead.










