2013/03/26

Conversion of Oracle function to its equivalent Teradata function

original link here:
http://www.javaorator.com/oracle/tutorial/conversion-of-oracle-function-to-its-equivalent-teradata-function-152.code

http://blog.csdn.net/fanxiaoliang83/article/details/4402378

Oracle FunctionsTeradata Functions
 DECODE(A,NULL,B,C) CASE WHEN A IS NULL THEN B ELSE C END
 DECODE(A,B,C,D) CASE A WHEN B THEN C ELSE D END
 GREATEST(A,B) CASE WHEN A >= B THEN A ELSE B END
 INSTR(A,B) INDEX(A,B)
 LEAST(A,B) CASE WHEN A <= B THEN A ELSE B END
 LENGTH(A) CHAR_LENGTH(A)
 LPAD(A,B) CAST(A AS CHAR(B))
 LTRIM(A,B) TRIM(LEADING B FROM A)
 MONTHS_BETWEEN(A,B) ABS(CAST((A - B MONTH) AS INTEGER))
 RTRIM(A,B) TRIM(TRAILING B FROM A)
 TO_CHAR(ANUMBER,B) CAST((ANUMBER (FORMAT B)) AS CHAR(X))
 NVL(A,B) COALESCE(A,B)
 TO_CHAR(ADATE,B) CAST((ADATE (FORMAT B)) AS CHAR(X))
 TO_CHAR(ADATE,'MM_YY') (ADATE (FORMAT'MM')) || '_' || (ADATE (FORMAT'YY'))
 TO_CHAR(X[,F]) CAST(X AS CHAR [FORMAT F])
 TRUNC(T[,F]) CAST(D AS DATE [FORMAT F])
 TO_NUM(X[,F]) CAST(X AS NUMERIC [FORMAT F])
 TO_DATE(X[,F]) CAST(X AS DATE [FORMAT F])
 TO_NUMBER(X[,F]) CAST(X AS NUMERIC [FORMAT F])
 SIGN(A) CASE A WHEN > 0 THEN 1 WHEN < 0 THEN -1 ELSE 0 END