更新时间:2024-06-29 GMT+08:00

数学函数

**

输入:**

1
expr1 ** expr2

输出

1
expr1 ^ expr2

MOD

输入:MOD

1
expr1 MOD expr2

输出

1
 expr1 % expr2

NULLIFZERO

可以使用tdMigrateNULLIFZERO参数来配置NULLIFZERO迁移。

输入:NULLIFZERO
1
2
SELECT NULLIFZERO(expr1) FROM tab1 
WHERE  ;

输出

1
2
SELECT NULLIF(expr1, 0) FROM tab1 
 WHERE  ;

ZEROIFNULL

可以使用tdMigrateZEROIFNULL参数来配置ZEROIFNULL迁移。

输入:ZEROIFNULL
1
2
SELECT ZEROIFNULL(expr1) FROM tab1 
WHERE  ;

输出

1
2
SELECT COALESCE(expr1, 0) FROM tab1 
 WHERE  ;

声明Hexadecimal Character Literal值

输入

SELECT 
 (COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.ID),''))
 ||'7E'xc||(COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.Code),''))
 ||'7E'xc||(COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.Description),''))
 ||'7E'xc||(COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.Name),''))
 ||'7E'xc||(COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.Host_Product_Id),''))
FROM DP_VTXEDW.VTX_D_RPT_0017_WMSE12_01_01   VTX_D_RPT_0017_WMSE12_01_01
WHERE 1=1
;

输出

SELECT 
 (COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.ID),''))
 ||E'\x7E'||(COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.Code),''))
 ||E'\x7E'||(COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.Description),''))
 ||E'\x7E'||(COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.Name),''))
 ||E'\x7E'||(COALESCE(TRIM(BOTH FROM VTX_D_RPT_0017_WMSE12_01_01.Host_Product_Id),''))
FROM DP_VTXEDW.VTX_D_RPT_0017_WMSE12_01_01   VTX_D_RPT_0017_WMSE12_01_01
WHERE 1=1
;

声明Hexadecimal Binary Literal值

输入:

CREATE MULTISET TABLE bvalues (IDVal INTEGER, CodeVal BYTE(2));
INSERT INTO bvalues VALUES (112193, '7879'XB) ;
SELECT IDVal, CodeVal FROM bvalues WHERE CodeVal = '7879'XB ; 

输出

CREATE TABLE bvalues (IDVal INTEGER, CodeVal BYTEA);
INSERT INTO bvalues VALUES (112193, BYTEA '\x7879') ;
SELECT IDVal, CodeVal FROM bvalues WHERE CodeVal = BYTEA '\x7879' ;