Quick Search:
 
 The Oracle CAST Function      [Return To Index] Jump to:  

Term: CAST

Definition:
The Oracle CAST function converts one datatype to another.

Example Usage:

SELECT cast( '22-Aug-2003' AS varchar2(30))
FROM dual;


This would convert the date ' 15-May-2010' into a varchar2(30) value.

Casting Built-In Datatypes
  from BINARY_FLOAT, BINARY_DOUBLE from CHAR, VARCHAR2 fromNUMBER from DATETIME / INTERVAL (Note 1) fromRAW from ROWID, UROWID (Note 2) from NCHAR, NVARCHAR2
to BINARY_FLOAT, BINARY_DOUBLE X X X X
to CHAR, VARCHAR2 X X X X X X
to NUMBER X X X X
to DATE, TIMESTAMP, INTERVAL X X
to RAW X X
to ROWID, UROWID X Xa
to NCHAR, NVARCHAR2 X X X X X X


Note 1: Datetime/interval includes DATE, TIMESTAMP, TIMESTAMP WITH TIMEZONE, INTERVAL DAY TO SECOND, and INTERVAL YEAR TO MONTH.

Note 2: You cannot cast a UROWID to a ROWID if the UROWID contains the value of a ROWID of an index-organized table.

Related Links:

Related Code Snippets:
  • CAST - CAST converts one built-in datatype or collection-typed value into another built-in datatyp...
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org