DB2 Columnar Functions- CAST and DECIMAL

Srinimf IT JOBS
Srinimf IT JOBS

CAST can be used to change the data type of an expression to a different data type or the same data type with a different length, precision, or scale.

SELECT EMPNO, CAST(SALARY AS INTEGER)
FROM   Samples.EMP;

The specified data type if DB2 not supported, DB2 will through an error.

Columnar Functions:

DECIMAL(BONUS) is equal to :-

SELECT EMPNO, CAST(BONUS AS DECIMAL(10,2))
FROM   Samples.EMP;

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.