Unix脚本来生成创建表语句

时间:2018-08-16 12:44:10

标签: unix

我已经搜索了论坛,但未找到实现以下目标的正确方法或代码:

我有一个具有以下各列的excel工作表

1   Database Name
2   Table Name
3   Set/Multiset Table
4   Table type
5   Columns
6   Attribute Datatype
7   Attribute Datalength
8   Nullable
9   Scale
10  Precision
11  Casespecific
12  Index type
13  Index Column 
14  Fallback

Database Name   Table Name  Set/Multiset Table  Table type  Columns Attribute Datatype  Attribute Datalength    Nullable    Scale   Precision   Casespecific    Index type  Index Column    Fallback
DWH_ETL_USER    WT_DwhEtl_Meta_Batch_Frequency  Multiset    WT  Batch_Cd    VARCHAR 10  Null            CHARACTER SET LATIN NOT CASESPECIFIC    Unique  Batch_Cd    No Fallback
DWH_ETL_USER    WT_DwhEtl_Meta_Batch_Frequency  Multiset    WT  Batch_SKey  DECIMAL 12  Null    12  2   CHARACTER SET LATIN NOT CASESPECIFIC            No Fallback
DWH_ETL_USER    WT_DwhEtl_Meta_Batch_Frequency  Multiset    WT  Batch_Name  VARCHAR 50  Null                        No Fallback
DWH_ETL_USER    WT_DwhEtl_Meta_Batch_Frequency  Multiset    WT  Batch_Invoker_Name  VARCHAR 50  Null            CHARACTER SET LATIN NOT CASESPECIFIC            No Fallback
DWH_ETL_USER    WT_DwhEtl_Meta_Batch_Frequency  Multiset    WT  Batch_Invoker_Qual

unix中有什么方法可以将其转换为以下格式

CREATE SET TABLE DWH_ETL_USER.WT_DwhEtl_Meta_Batch_Frequency ,NO FALLBACK ,
     NO BEFORE JOURNAL,
     NO AFTER JOURNAL,
     CHECKSUM = DEFAULT,
     DEFAULT MERGEBLOCKRATIO
     (
      Batch_Cd VARCHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC,
      Batch_SKey INTEGER,
      Batch_Name VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Batch_Invoker_Name VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Batch_Invoker_Qual_Name VARCHAR(150) CHARACTER SET LATIN NOT CASESPECIFIC,
      Run_Environment CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC,
      Etl_Application_Name VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Etl_SubApplication_Name VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      DB_User VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Run_Time_Min VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Run_Time_Hour VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Run_Time_Day_Of_Month VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Run_Time_Month VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Run_Time_Day_Of_Week VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Run_Frequency VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Schedule_Status VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      User_Record_Ind CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC,
      Last_Updated_By VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Work_Record_Ind CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC)
UNIQUE PRIMARY INDEX ( Batch_Cd );

0 个答案:

没有答案