22.5 Defining a table and index

This section explains the definition of a table for storing the SGML documents in order to create a database and the definition of the index that is needed for data retrieval.

Figure 22-3 shows the table that is defined in simple installation.

Figure 22-3 Table used in the examples

[Figure]

  1. The table called manual consists of the column num for storing manual's chapter numbers and the column doc for storing manual's SGML documents.
  2. User RDAREA USR1 is assigned to the num column for chapter numbers.
  3. User LOB RDAREA ULOB1 is assigned to the doc column for the SGML documents.
  4. An index named idx for making retrievals from manual's SGML documents is defined and then user LOB RDAREA ULOB2 is assigned to it.

To define the table and index:

  1. Enter HiRDB's pddef command.
  2. Enter the information shown as follows. Use the Enter key for linefeeds.
  3. When step 2 is completed, press Ctrl+D to terminate the pddef command. The table is defined and the pddef command is terminated.

    CREATE TABLE manual(
     num CHAR(10) NOT NULL,
     doc SGMLTEXT
      ALLOCATE(SGMLTEXT IN(ULOB1))
      PLUGIN '<DTD>MAN.DTD</DTD>'
      )IN (USR1);

    CREATE INDEX idx
     USING TYPE NGRAM
     ON manual(doc)
     IN(ULOB2);