更新时间:2022-08-16 GMT+08:00

DML(Netezza)

高斯关键字:SOURCE指定为无AS关键字的列别名

Netezza语法

迁移后语法

SELECT SUBSTR( OP_SOURCE ,1 ,4 ) SOURCE
     , ONLINE_FLAG, 'TRD' AS SRC_SYS
     , CURRENT_TIMESTAMP AS ETL_LOAD_TIME
  FROM tb_keyword_source;
SELECT SUBSTR( OP_SOURCE ,1 ,4 ) AS SOURCE
     , ONLINE_FLAG, 'TRD' AS SRC_SYS
     , CURRENT_TIMESTAMP AS ETL_LOAD_TIME
  FROM tb_keyword_source;

FREEZE

Netezza语法

迁移后语法

INSERT INTO tmp_tb_keyword_freeze 
     ( BRANCH_CODE, FREEZE, UNFREEZE, BRAN_JYSDM )
SELECT BRANCH_CODE, FREEZE, UNFREEZE, BRAN_JYSDM
  FROM tb_keyword_freeze;
INSERT INTO tmp_tb_keyword_freeze 
     ( BRANCH_CODE, "FREEZE", UNFREEZE, BRAN_JYSDM )
SELECT BRANCH_CODE, "FREEZE", UNFREEZE, BRAN_JYSDM
  FROM tb_keyword_freeze;

新增配置参数keywords_addressed_using_doublequote,其值为:

keywords_addressed_using_doublequote=freeze

keywords_addressed_using_as=owner,attribute,source,freeze

create table t12 (c1 int, FREEZE varchar(10)); ==> create table t12 (c1 int, "freeze" varchar(10));

select c1, Freeze from t12; ==> select c1, "freeze" from t12;

select c1 freeze from t12; ==> select c1 as freeze from t12;

OWNER (应指定AS)

Netezza语法

迁移后语法

SELECT username owner
  FROM tb_ntz_keyword_owner;
SELECT username AS owner
  FROM tb_ntz_keyword_owner;

ATTRIBUTE (应指定AS)

Netezza语法

迁移后语法

SELECT t1.etl_date, substr(t1.attribute,1,1) attribute
     , t1.cust_no, t1.branch_code
  FROM ( SELECT etl_date,attribute,cust_no,branch_code
           FROM tb_ntz_keyword_attribute
          WHERE etl_date = CURRENT_DATE ) t1;
SELECT t1.etl_date, substr(t1.attribute,1,1) AS attribute
     , t1.cust_no, t1.branch_code
  FROM ( SELECT etl_date,attribute,cust_no,branch_code
           FROM tb_ntz_keyword_attribute
          WHERE etl_date = CURRENT_DATE ) t1;