ALLBASE/SQL Reference Manual (36216-90216)
Chapter 11 445
SQL Statements E - R
INSERT
INSERT
The INSERT command adds rows to a table. The following two forms of the INSERT
command are described individually:
• The form used to add rows having values you define. You can add a single row or (in an
application program) you can insert multiple rows using the bulk facility. There is
special syntax for prepared INSERT and BULK INSERT statements that use dynamic
parameter substitution.
• The form used to add rows defined by a SELECT command. This form copies rows from
one or more tables or views into a table and is called a Type 2 INSERT.
Rules defined with a
StatementType
of INSERT will affect both forms of INSERT command.
Scope
ISQL or Application Programs
SQL Syntax - Insert Rows with Defined Values
[BULK]INSERT INTO { [
Owner.
]
TableName
[
Owner.
]
ViewName
}
[({
ColumnName
}[,...])]
VALUES ({
SingleRowValues
BulkValues
?
})
Parameters - Insert Rows with Defined Values
BULK is specified in an application program to insert multiple rows with a single
execution of the INSERT command.
[
Owner
.]
TableName
identifies the table to which data is to be added.
[
Owner
.]
ViewName
identifies a view on a single table; the data is added to the table
upon which the view is based. Refer to the CREATE VIEW command for
restrictions governing insertion via a view.
ColumnName
specifies a column for which values are supplied.
If you omit any of the table's columns from the column name list, the
INSERT command places the default value of the respective column
definitions in the omitted columns. For columns with no default value, the
null value is placed in the omitted columns. If the table definition specifies
NOT NULL for any of the omitted columns, the INSERT command fails.
You can omit the column name list if you provide values for all columns of
the table in the same order the columns were specified in the CREATE
TABLE (or CREATE VIEW) command.
VALUES The VALUES clause specifies the values corresponding to the columns in
the column name list, or the columns specified in the CREATE TABLE or