ALLBASE/SQL Reference Manual (36216-90216)

Chapter 11 451
SQL Statements E - R
INSERT
is truncated. Refer to Chapter 7 , “Data Types,” for information on overflow and
truncation of other data types.
No error or warning condition is generated by ALLBASE/SQL when a character or
binary string is truncated during an INSERT operation.
Using the INSERT command with views requires that the views be based on queries
that are updatable. See "Updatability of Queries" in Chapter 3 , “SQL Queries.
Values in referenced (primary key) columns must be inserted before values in
referencing (foreign key) columns. However, if you do a bulk insertion, inserting the
primary key rows after the foreign key rows does not cause an error message, because
the constraints are satisfied by the time you COMMIT WORK.
A table on which a unique constraint is defined cannot contain duplicate rows.
BINARY and VARBINARY data can be inserted in character or hexadecimal format.
Character format requires single quotes and hexadecimal requires a 0x before the
value.
Under the default settings for the SET DML ATOMICITY and SET CONSTRAINTS
statements, integrity constraints on tables and views are enforced on a statement level
basis and if a constraint should be violated during processing of the insert, no rows are
inserted. However, the SET DML ATOMICITY and SET CONSTRAINTS statements both
override the default behavior. For more information, it is important that you refer to the
section "Error Conditions in ALLBASE/SQL" in Chapter 1 , “Introduction,”and the SET
DML ATOMICITY or the SET CONSTRAINTS statements in this chapter.
Rows being inserted must not cause the search condition of the table check constraint to
be false and must cause the search condition of the view check constraint to be true.
Rows being inserted in the table through a view having a WITH CHECK OPTION must
satisfy the check constraint of the view and any underlying views in addition to
satisfying any constraints of the table. Refer to the "Check Constraints" section
inChapter 4 , “Constraints, Procedures, and Rules,” for more information on check
constraints.
Rules defined with a
StatementType
of INSERT will affect all kinds of INSERT
statements performed on the rules' target tables. When the INSERT is performed,
ALLBASE/SQL considers all the rules defined for that table with the INSERT
StatementType
. If the rule has no condition, it will fire for all rows affected by the
statement and invoke its associated procedure with the specified parameters on each
row. If the rule has a condition, it will evaluate the condition on each row. The rule will
fire on rows for which the condition evaluates to TRUE and invoke the associated
procedure with the specified parameters for each row. Invoking the procedure could
cause other rules, and thus other procedures, to be invoked if statements within the
procedure trigger other rules.
If a DISABLE RULES statement is in effect, the INSERT statement will not fire any
otherwise applicable rules. When a subsequent ENABLE RULES is issued, applicable
rules will fire again, but only for subsequent INSERT statements, not for those rows
processed when rule firing was disabled.
In a rule defined with a
StatementType
of INSERT, any column reference in the
Condition
or any
ParameterValue
will refer to the value of the column as it is