Reserved Table Names; Authorization And Availability Requirements - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

This may cause duplicates to be experienced because the current value of the internal sequence
generator is incremented to values that are already present in the IDENTITY column of table t2.
To avoid this problem, HP recommends that you determine a START WITH value that is greater
than the largest value of the IDENTITY column of the source table. For example:
SELECT MAX(a) FROM t1;
(EXPR)
---------
15
The CREATE TABLE AS statement for table t2 would then include internal sequence generator
options. This sets the current value of the created internal sequence generator table to a value
greater than the maximum value of the IDENTITY column to be added:
CREATE TABLE t2 (a LARGEINT GENERATED BY DEFAULT AS IDENTITY
SELECT * FROM t2;
A
B
15
1
INSERT INTO t2 VALUES (DEFAULT,1);
SELECT * FROM t2;
A
B
15
1
16
1
In the next example, table t3 provokes an error because you tried to create a column with the
GENERATED ALWAYS AS IDENTITY column, which is not allowed.
CREATE TABLE t3 (a LARGEINT GENERATED ALWAYS AS IDENTITY NOT NULL,
*** ERROR[3428] IDENTITY column A defined as GENERATED ALWAYS cannot
accept values specified by the user.

Reserved Table Names

Table names prefixed by the name of a user metadata table are reserved. You cannot create tables
with such names. For example, you cannot create tables that are prefixed by these names:
HISTOGRAMS
HISTOGRAM_INTERVALS
MVS_TABLE_INFO_UMD
MVS_UMD
MVS_USED_UMD

Authorization and Availability Requirements

To create a table, you must own the schema or be granted the CREATE or CREATE_TABLE
privilege for the schema. To create a constraint on the table that refers to a column in another
table, you must have REFERENCES privileges on that column and access to the table that contains
the column. If the constraint refers to the other table in a query expression, you must also have
SELECT privileges on the other table.
86
SQL Statements
(MINVALUE 10
MAXVALUE 99999
START WITH 16)
NOT NULL, b INT UNSIGNED NOT NULL,
PRIMARY KEY(a)) AS SELECT a,b FROM t1;
b INT, PRIMARY KEY(a)) AS SELECT a,b FROM t1;

Advertisement

Table of Contents
loading

Table of Contents