Transient external table examples

You can specify the shape of a transient external table (TET).

The following examples show how to specify the shape:
  • To use the schema of the target table, enter the following command:
    insert into <table> select * from external '<file>' [USING(...)]
  • To use the schema of the query, enter the following command:
    create external table '<file>' [USING (...)] as <QUERY>
  • To use the schema of <table>, enter the following command:
    select * from external '<file>' sameas <table> [USING(...)]
  • To use the schema as defined, enter the following command:
    select * from external '<file>' (schema) [USING(...)]
  • To use the schema as defined, enter the following command:
    create external table '<file>' (schema) [USING(...)]
  • To make the source file fixed format with the schema as defined, enter the following command:
    select * from external '<file>' (schema) USING (FORMAT 'FIXED' 
    LAYOUT (...))
  • To make the source file fixed format and the table use the schema of the target table, enter the following command:
    insert into <table> select * from external '<file>' USING (FORMAT 
    'FIXED' LAYOUT (...))
  • The following example does not work, because you cannot unload data into a fixed format external table:
    create external table '<file>' [(schema)] USING (FORMAT 'FIXED' 
    LAYOUT ... )