Creating the Text Table

Perform the following steps to create and load documents into a table.

  1. Connect as the New User

    Before creating any tables, assume the identity of the user you just created.

    CONNECT myuser;
    
  2. Create your Text Table

    The following example creates a table called docs with two columns, id and text, by using the CREATE TABLE statement. This example makes the id column the primary key. The text column is VARCHAR2.

    CREATE TABLE docs (id NUMBER PRIMARY KEY, text VARCHAR2(200));
    

    Note:

    Primary keys of the following type are supported:NUMBER, VARCHAR2, DATE, CHAR, VARCHAR, and RAW.

  3. Load Documents into Table

    Use the SQL INSERT statement to load text to a table.

    To populate the docs table, use the INSERT statement as follows:

    INSERT INTO docs VALUES(1, '<HTML>California is a state in the US.</HTML>');
    INSERT INTO docs VALUES(2, '<HTML>Paris is a city in France.</HTML>');
    INSERT INTO docs VALUES(3, '<HTML>France is in Europe.</HTML>');