Neoview SQL Reference Manual (R2.4)

Syntax Description of ALTER TABLE
name
specifies the current name of the object. See “Database Object Names” (page 228).
NO INSERTLOG | INSERTLOG
specifies whether update and delete operations are recorded in the table’s IUD log.
When a table is defined with the INSERTLOG attribute, logging operations ignore delete
and update operations and log inserts only. This logging is needed to maintain ON REQUEST
materialized views. If no ON REQUEST materialized views are defined on the table, this
attribute has no effect.
ADD [COLUMN] column-definition
adds a column to table.
The clauses for the column-definition are:
column-name
specifies the name for the new column in the table. column-name is an SQL identifier.
column-name must be unique among column names in the table. If the column name
is a Neoview SQL reserved word, you must delimit it by enclosing it in double quotes.
For example: "sql".myview. See “Identifiers” (page 252).
data-type
specifies is the data type of the values that can be stored in column. See “Data Types”
(page 229). If a default is not specified, NULL is used.
DEFAULT default
specifies a default value for the column or specifies that the column does not have a
default value. You can declare the default value explicitly by using the DEFAULT clause,
or you can enable null to be used as the default by omitting both the DEFAULT and NOT
NULL clauses. If you omit the DEFAULT clause and specify NOT NULL, Neoview SQL
returns an error. For existing rows of the table, the added column takes on its default
value.
If you set the default to the datetime value CURRENT_DATE, CURRENT_TIME, or
CURRENT_TIMESTAMP, Neoview SQL uses January 1, 1 A.D. 12:00:00.000000 as the
default date and time for the existing rows.
For any row that you add after the column is added, if no value is specified for the column
as part of the add row operation, the column receives a default value based on the current
timestamp at the time the row is added.
CONSTRAINT constraint
specifies a name for the column or table constraint. constraint must have the same
schema as table and must be unique among constraint names in its schema. If you omit
the schema portions of the name you specify in constraint, Neoview SQL expands
the constraint name by using the schema for table. See “Database Object Names”
(page 228).
If you do not specify a constraint name, Neoview SQL constructs an SQL identifier as the
name for the constraint in the schema for table. The identifier consists of the fully
qualified table name concatenated with a system-generated unique identifier. For example,
a constraint on table A.B.C might be assigned a name such as A.B.C_123..._01... .
ADD [CONSTRAINT constraint] table-constraint
adds a constraint to the table and optionally specifies constraint as the name for the
constraint. The new constraint must be consistent with any data already present in the table.
CONSTRAINT constraint
specifies a name for the column or table constraint. constraint must have the same
schema as table and must be unique among constraint names in its schema. If you omit
ALTER TABLE Statement 47