HP 3000 Manuals

CREATE TABLE [ ALLBASE/Replicate User's Guide ] MPE/iX 5.0 Documentation


ALLBASE/Replicate User's Guide

CREATE TABLE 

The CREATE TABLE statement defines a table.  It also defines the locking
strategy that ALLBASE/SQL uses automatically when the table is accessed
and in some cases automatically issues a GRANT statement.  It can also
define the storage structure of the table and restrictions or defaults
placed on values which the table's columns can hold.  It can also be
assigned to a partition for audit logging purposes.

Scope 

ISQL or Application Programs

SQL Syntax--CREATE TABLE 

       [PUBLIC    ]
CREATE [PUBLICREAD] TABLE [Owner.]TableName  [LANG = TableLanguageName]
       [PRIVATE   ]

  {ColumnDefinition                                   }
( {[{UniqueConstraint     }                          ]} [,...])
  {[{ReferentialConstraint} [CONSTRAINT ConstraintID]]}
  {[{CheckConstraint      }                          ]}

[UNIQUE HASH ON (HashColumnName [,...]) PAGES = PrimaryPages]
[HASH ON CONSTRAINT [ConstraintID] PAGES = PrimaryPages     ]
[CLUSTERING ON CONSTRAINT [ConstraintID]                    ]

[             {PartitionName}]
[IN PARTITION {DEFAULT      }] [IN DBEFileSetName]
[             {NONE         }]
Parameters--CREATE TABLE 

PartitionName           specifies what partition the table will be in for
                        the purposes of audit logging.

DEFAULT                 specifies that the default partition of the
                        database will be used.  The number associated
                        with the default partition is determined at the
                        time the INSERT, UPDATE, or DELETE is executed on
                        the table.  If the default partition is NONE at
                        that time, the operation will not be replicated.
                        Any change to the default partition number
                        occurring in a START DBE NEWLOG statement alters
                        the partition number that audit logging uses on
                        tables that are in the default partition.

NONE                    specifies that this table is assigned to no
                        partition, and so will not be replicated.

Description 

   *   The partition must be already created by the CREATE PARTITION
       statement, be the default partition, or be NONE.

   *   The partition number of a table's partition is recorded in any
       audit logging done on that table.  Audit logging is done on any
       INSERT, UPDATE, or DELETE performed on a table while the
       DBEnvironment is enabled for DATA audit logging.

   *   Audit logging is not done on any LONG column data for the table.

   *   If no partition is specified, the table is placed in the DEFAULT
       partition.

   *   To specify that a table is in no partition, the partition NONE can
       be specified.

   *   Partitions can be created and tables placed in them without DATA
       audit logging being enabled for a DBEnvironment.  However, the
       partition information is only used in audit log records.  Thus,
       partition information is not utilized until the DBEnvironment has
       DATA audit logging enabled through the START DBE NEWLOG statement.

Authorization 

You must have RESOURCE or DBA authority to use this statement.

Example 

     This public table is accessible to any user or program that can
     start a DBE session. It is also accessible by concurrent transactions.
     The table is assigned to partition PartsPart. 

     CREATE PUBLIC TABLE PurchDB.SupplyPrice
                         (PartNumber  CHAR(16) NOT NULL,
                         VendorNumber  INTEGER  NOT NULL,
                         VendPartNumber CHAR(16) NOT NULL,
                         UnitPrice  DECIMAL(10,2),
                         DeliveryDays  SMALLINT DEFAULT 0,
                         DiscountQty  SMALLINT)
                       IN PARTITION PartsPart 
                      IN PurchFS;

     REVOKE ALL PRIVILEGES ON PurchDB.SupplyPrice FROM PUBLIC;

     GRANT SELECT,UPDATE ON Purch.DB.SupplyPrice TO Accounting;



MPE/iX 5.0 Documentation