Updated on 2023-03-17 GMT+08:00

Math Functions

**

Input: **

1
expr1 ** expr2

Output

1
expr1 ^ expr2

MOD

Input: MOD

1
expr1 MOD expr2

Output

1
 expr1 % expr2

NULLIFZERO

Use the tdMigrateNULLIFZERO configuration parameter to configure migration of NULLIFZERO.

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

Output

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

ZEROIFNULL

Use the tdMigrateZEROIFNULL configuration parameter to configure migration of ZEROIFNULL.

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

Output

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

Declaring a Hexadecimal Character Literal Value

Input

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
;

Output

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
;

Declaring a Hexadecimal Binary Literal Value

Input

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 ; 

Output

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