17.10 - DEFINE SCHEMA文の例 - Parallel Transporter

Teradata® Parallel Transporter リファレンス

Product
Parallel Transporter
Release Number
17.10
Published
2022年2月
Content Type
プログラミング リファレンス
Publication ID
B035-2436-061K-JPN
Language
日本語 (日本)
Last Update
2022-02-11

次のテーブルに、DEFINE SCHEMA文の例を示します。

DEFINE SCHEMA文の例
ステートメントの例
例1
DEFINE SCHEMA PRODUCT_SOURCE_SCHEMA
   DESCRIPTION 'PRODUCT INFORMATION'
(
   PRODUCT_NAME                 VARCHAR(24),
   PRODUCT_CODE                 INTEGER,
   PRODUCT_DESCRIPTION          VARCHAR(512),
   PRODUCT_COST                 INTEGER,
   PRODUCT_PRICE                INTEGER,
   PRODUCT_WARRANTY             CLOB(50000),
   PRODUCT_PICTURE              BLOB (40000000) AS DEFERRED BY NAME
);
例2
DEFINE SCHEMA FREQ_FLYER_SRC
ADJUST UNICODE
DESCRIPTION 'SCHEMA FOR FREQUENT FLYER SOURCE FILE'
(
   RES_ID VARCHAR(14),
   FLIGHT_NO SMALLINT,
   ORIGIN CHAR(3),
   DEST CHAR(3),
   TKT_ID CHAR(12),
   TKT_ISSUE_DATE ANSIDATE,
   TKT_AMT DECIMAL(5,2),
   TRAVEL_AGCY_ID CHAR(4),
   FREQ_MILES_ID CHAR(8)
);
例3
DEFINE SCHEMA PRODUCT_SOURCE_SCHEMA
DESCRIPTION 'PRODUCT INFORMATION'
(
   PRODUCT_CODE                INTEGER,
   PRODUCT_NAME                VARCHAR(24)   MACROCHARSET UNICODE,
   PRODUCT_DESCRIPTION         VARCHAR(512)  MACROCHARSET LATIN,
   PRODUCT_TYPE                CHAR(2)       MACROCHARSET KANJI,
   PRODUCT_COST                INTEGER,
   PRODUCT_PRICE               INTEGER
);
例4
DEFINE SCHEMA EMPLOYEE_SCHEMA
DESCRIPTION 'SAMPLE EMPLOYEE SCHEMA'
(
   EMP_ID      INTEGER,
   EMP_NAME    CHAR(30),
   EMP_DEPT    INTEGER,
   JOBDURATION PERIOD(DATE) USINGEXTENSION('AS VALIDTIME')
);
例5
DEFINE SCHEMA EMPLOYEE_SCHEMA
DESCRIPTION 'SAMPLE EMPLOYEE SCHEMA'
(
   EMP_ID       INTEGER,
   EMP_NAME     CHAR(30),
   EMP_DEPT     INTEGER,
   JOB_START    INTDATE,
   JOB_END      INTDATE USINGEXTENSION('PERIOD FOR JOBDURATION
                                     (JOB_START, JOB_END) AS VALIDTIME')
);
例6
DEFINE SCHEMA INVENTORY_SCHEMA1
DESCRIPTION 'SAMPLE INVENTORY SCHEMA'
(
   FILE_NAME    VARCHAR(30) METADATA(FILENAME),
   REC_NUMBER   BIGINT METADATA(FILERECORDNUMBER),
   ITEM_NUMBER  INTEGER,
   DESCRIPTION  VARCHAR(100),
   QUANTITY     INTEGER,
   PRICE        DECIMAL(6,2)
);
例7
DEFINE SCHEMA INVENTORY_SCHEMA2
DESCRIPTION 'SAMPLE INVENTORY SCHEMA'
(
   ITEM_NUMBER  INTEGER,
   DESCRIPTION  VARCHAR(100),
   QUANTITY     INTEGER,
   PRICE        DECIMAL(6,2),
   REC_NUMBER   INTEGER METADATA(FILERECORDNUMBER),
   FILE_NAME    CHAR(25) METADATA(FILENAME)
);