Data Base Tips/ SQL Commands...

Tuesday, July 12, 2005

Conversion Function (CAST)

In Oracle/PLSQL, the cast function converts one datatype to another.

The syntax for the cast function is:

cast ( { expr | ( subquery ) | MULTISET ( subquery ) } AS type_name )

For example:

SELECT CAST ( '22-AUG-2003' AS VARCHAR2(30) ) FROM DUAL;

This would convert the date (i.e.: 22-Aug-2003) into a varchar2(30) value.

3 Comments:

Post a Comment

<< Home