Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
ALLBASE/SQL Database Administration Guide: HP 9000 Computer Systems > Chapter 5 Database Creation and Security

Creating Hash Structures

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

You create a hash structure at the same time you create a table, using the CREATE TABLE statement, as in the following syntax.

CREATE [ PUBLIC PUBLICREAD PRIVATE ] TABLE [Owner.] TableName [LANG = TableLanguageName] ( {ColumnName ColumnDataType [LANG = ColumnLanguageName] [NOT NULL]} [,...]) [UNIQUE HASH ON (HashColumnName [,...]) PAGES = PrimaryPages] [IN DBEFileSetName]

Refer to the ALLBASE/SQL Reference Manual for complete syntax and semantics.

The following sequence of statements shows how to create the PurchDB.Vendors table using a hash structure. Commands to create and add a dedicated DBEFile to contain the hash structure are also shown, since there must be sufficiently large empty DBEFiles of type TABLE or MIXED available when you issue the CREATE TABLE statement in creating a hash structure:



   isql=> BEGIN WORK;



   isql=> CREATE DBEFile PurchHashF1

   > WITH PAGES = 120, NAME = 'PurchHF1',

   > TYPE = TABLE;



   isql=> ADD DBEFile PurchHashF1

   > TO DBEFILESET PurchFS;



   isql=> CREATE PUBLIC TABLE PurchDB.Vendors

   > (VendorNumber      INTEGER           NOT NULL,

   >  VendorName        CHAR(30)          NOT NULL,

   >  ContactName       CHAR(30),

   >  PhoneNumber       CHAR(15),

   >  VendorStreet      CHAR(30)          NOT NULL,

   >  VendorCity        CHAR(20)          NOT NULL,



   >  VendorState       CHAR(2)           NOT NULL,

   >  VendorZipCode     CHAR(10)          NOT NULL,

   >  VendorRemarks     VARCHAR(60) )

   > UNIQUE HASH ON (VendorNumber) PAGES = 101

   > IN PurchFS;



   isql=> COMMIT WORK;

Note that all these statements are shown as part of the same transaction. This ensures that the DBEFiles you create will not be used by any other transaction before the hash structure is created.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.