文档首页 > > 工具指南> DSC SQL语法迁移工具> SQL语法迁移参考> Netezza语法迁移> DML

DML

分享
更新时间:2020/08/05 GMT+08:00

高斯关键字: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;
分享:

    相关文档

    相关产品

文档是否有解决您的问题?

提交成功!

非常感谢您的反馈,我们会继续努力做到更好!

反馈提交失败,请稍后再试!

*必选

请至少选择或填写一项反馈信息

字符长度不能超过200

提交反馈 取消

如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨

智能客服提问云社区提问