Neoview SQL Reference Manual (R2.5)

INSERT Statement
“Syntax Description of INSERT”
“Considerations for INSERT”
“Examples of INSERT”
The INSERT statement is a DML statement that inserts rows in a table or view.
INSERT [NOMVLOG] [WITH NO ROLLBACK] INTO table [(target-col-list)] insert-source
target-col-list is:
colname [,colname]...
insert-source is:
query-expr [order-by-clause] [access-clause] | DEFAULT VALUES
Syntax Description of INSERT
NOMVLOG
specifies that the operation will not be recorded in the log table. Once this option is used, a
materialized view will no longer be consistent with its base tables until it is recomputed.
WITH NO ROLLBACK
specifies that the transaction within which the INSERT statement is executing does not
rollback if a transaction aborts. If you specify this option when AUTOCOMMIT is set to OFF,
an error code is generated. If AUTOCOMMIT is set to OFF, you can use the SET
TRANSACTION statement to enable the NO ROLLBACK option for the transaction. See
“SET TRANSACTION Statement” (page 188).
table
names the user table or view in which to insert rows. table must be a base table or an
updatable view.
(target-col-list)
names the columns in the table or view in which to insert values. The data type of each target
column must be compatible with the data type of its corresponding source value. Within the
list, each target column must have the same position as its associated source value, whose
position is determined by the columns in the table derived from the evaluation of the query
expression (query-expr).
If you do not specify all of the columns in table in the target-col-list, column default
values are inserted into the columns that do not appear in the list. See “Column Default
Settings” (page 236).
If you do not specify target-col-list, row values from the source table are inserted into
all columns in table. The order of the column values in the source table must be the same
order as that of the columns specified in the CREATE TABLE for table. (This order is the
same as that of the columns listed in the result table of SHOWDDL table.)
insert-source
specifies the rows of values to be inserted into all columns of table or, optionally, into
specified columns of table.
query-expr
For the description of query-expr, order-by-clause, and access-clause, see the
“SELECT Statement” (page 164).
DEFAULT VALUES
is equivalent to a query-expr of the form VALUES (DEFAULT, ...). The value of each
DEFAULT is the default value defined in the column descriptor of colname, which is
contained in the table descriptor of table. Each default value is inserted into its column
144 SQL Statements