In Oracle/PLSQL, the cast function converts one datatype to another.
Syntax
The syntax for the cast function is:
cast ( { expr | ( subquery ) | MULTISET ( subquery ) } AS type_name )
Note
The following casts are allowed:
TO | FROM | |||||
char, varchar2 | number | datetime / interval | raw | rowid, urowid | nchar, nvarchar2 | |
char, varchar2 | X | X | X | X | X |
|
number | X | X |
|
|
|
|
datetime / interval | X |
| X |
|
|
|
raw | X |
|
| X |
|
|
rowid, urowid | X |
|
|
| X |
|
nchar, nvarchar2 |
| X | X | X | X | X |
Applies To
For Example
select cast( '22-Aug-2003' AS varchar2(30) )
from dual;
This would convert the date (ie: 22-Aug-2003) into a varchar2(30) value.