ALLBASE/SQL Reference Manual (36216-90216)

Chapter 10 359
SQL Statements A - D
CREATE TABLE
Parameters—Referential Constraint (Table Level)
FKColumnName
[,...] identifies the referencing column list. Each referencing column
shall be a column defined in the referencing table, and the same column
name shall not be identified more than once. The number of referencing
and referenced columns would be the same. The maximum number of
columns in a referencing column list is 15. None of the columns may be a
LONG data type.
RefTableName
identifies the base table being referenced. If no
RefColumnName
list
follows this, the base table must contain a PRIMARY KEY unique
constraint with the correct number of columns, each of the correct data
type.
RefColumnName
[,...] identifies the referenced column list. This column list must be
identical to a unique constraint column list of the referenced table.
ConstraintID
is an optional name specified for the constraint. If none is supplied, one is
generated, as described under "Description" below.
SQL Syntax—Check Constraint (Table Level)
CHECK (
SearchCondition
) [CONSTRAINT
ConstraintID
] [IN
DBEFileSetName3
]
Parameters—Check Constraint (Table Level)
CHECK specifies a check constraint.
SearchCondition
specifies a boolean expression for the check constraint. The result of
the boolean expression must not be false for any row of the table. The
result may be unknown if a column that is part of the expression is NULL.
The search condition may only contain LONG columns if they are within
long column functions. (Refer to long column functions in the
"Expressions" and "Data Types" chapters.) The search condition cannot
contain a subquery, host variable, aggregate function, built-in variable,
local variable, procedure parameter, dynamic parameter, TID function,
current function, or USER. Refer to the chapter, "Constraints, Procedures,
and Rules," for more information on check constraints.
ConstraintID
is an optional name specified for the constraint. If none is supplied, one is
generated, as described under "Description" below.
DBEFileSetName3
specifies the DBEFileSet to be used for storing the section associated
with the check constraint. If not specified, the default SECTIONSPACE
DBEFileSet is used. (Refer to syntax for the SET DEFAULT DBEFILESET
statement.)
Description
PUBLIC, PUBLICROW, PUBLICREAD, and PRIVATE are locking modes. They define
the type of locking ALLBASE/SQL uses automatically when the table is accessed. The
LOCK TABLE statement can be used to override automatic locking during any
transaction, if the override is to a more restrictive lock. If no locking mode is specified,