更新时间:2024-11-15 GMT+08:00

缩写关键字迁移

表1列出了Teradata支持的缩写关键字及其语法在GaussDB(DWS)中对应的语法。

表1 缩写关键字列表

Teradata语法

对应的GaussDB(DWS)语法

SEL

SELECT

INS

INSERT

UPD

UPDATE

DEL

DELETE

CT

CREATE TABLE

CV

CREATE VIEW

BT

START TRANSACTION

ET

COMMIT

输入:BT

BT;
--              
delete from ${BRTL_DCOR}.BRTL_CS_CUST_CID_UID_REL 
where DW_Job_Seq = ${v_Group_No};

.if ERRORCODE <> 0 then .quit 12;

--     
insert into ${BRTL_DCOR}.BRTL_CS_CUST_CID_UID_REL 
(
   Cust_Id
  ,Cust_UID
  ,DW_Upd_Dt
  ,DW_Upd_Tm
  ,DW_Job_Seq
  ,DW_Etl_Dt
)
select
   a.Cust_Id
  ,a.Cust_UID
  ,current_date as Dw_Upd_Dt
  ,current_time(0) as DW_Upd_Tm
  ,cast(${v_Group_No} as byteint) as DW_Job_Seq
  ,cast('${v_Trx_Dt}' as date format 'yyyy-mm-dd') as DW_Etl_Dt
from ${BRTL_VCOR}.BRTL_CS_CUST_CID_UID_REL_S a
where a.DW_Snsh_Dt = cast('${v_Trx_Dt}' as date format 'yyyy-mm-dd');

.if ERRORCODE <> 0 then .quit 12;

ET;cd ..

输出

BEGIN
--    
   BEGIN          
      delete from ${BRTL_DCOR}.BRTL_CS_CUST_CID_UID_REL  
       where DW_Job_Seq = ${v_Group_No};
         lv_mig_errorcode = 0;
   EXCEPTION
      WHEN OTHERS THEN
         lv_mig_errorcode = -1;
   END;

   IF lv_mig_errorcode <> 0 THEN
        RAISE EXCEPTION '12';
   END IF;

--     
   BEGIN
        insert into ${BRTL_DCOR}.BRTL_CS_CUST_CID_UID_REL 
        (
          Cust_Id
         ,Cust_UID
         ,DW_Upd_Dt
         ,DW_Upd_Tm
         ,DW_Job_Seq
         ,DW_Etl_Dt
       )
      select
          a.Cust_Id
         ,a.Cust_UID
         ,current_date as Dw_Upd_Dt
         ,current_time(0) as DW_Upd_Tm
         ,cast(${v_Group_No} as byteint) as DW_Job_Seq
         ,cast('${v_Trx_Dt}' as date format 'yyyy-mm-dd') as DW_Etl_Dt
       from ${BRTL_VCOR}.BRTL_CS_CUST_CID_UID_REL_S a
     where a.DW_Snsh_Dt = cast('${v_Trx_Dt}' as date format 'yyyy-mm-dd');
   EXCEPTION
      WHEN OTHERS THEN
         lv_mig_errorcode = -1;
   END;

   IF lv_mig_errorcode <> 0 THEN
        RAISE EXCEPTION '12';
   END IF;

END;