개인적인 정리

ORACLE CAST() 본문

DB/ORACLE

ORACLE CAST()

yeon.Biju 2020. 3. 24. 12:14

오라클 CAST()

 

CAST converts one built-in data type or collection-typed value into another built-in data type or collection-typed value.

 

CAST lets you convert built-in data types or collection-typed values of one type into another build-in data type or collection type. You can cast an unnamed operand(such as a date or the result set of a subquery) or a named collection(such as a varry or a nested table) into a type-compatible data type or named collection. The type_name must be the name of a built-in data type or collection type and the operand must be a built-in data type or must evaluage to a collection value.

 

CAST does not directly support any of the LOB data types,  When you use CAST to convert a CLOB value into a character data type or a BLOB value into the RAW data type, the database implicitly converts the LOB value to character or raw data and then explicitly casts the resulting value into the target data type. If the resulting value is larger than the target type, then the database returns an error.

 

 

Built-in Data Type Exapmples

 

SQL> SELECT CAST('22-OCT-1997' AS TIMESTAMP WITH LOCAL TIME ZONE) FROM DUAL ;

   --> 1997/10/22 AM 0:00:00.000000

 

SQL> SELECT CAST(TO_DATE('22-OCT-1997', 'DD-MON-YYYY') AS TIMESTAMP WITH LOCAL TIME ZONE) FROM DUAL ;

   --> 1997/10/22 AM 0:00:00.000000

 

Collection Examples

생략... 이해를 못했음. 

 

 

'DB > ORACLE' 카테고리의 다른 글

ORACLE COLLECT()  (0) 2020.03.25
ORACLE COALESCE()  (0) 2020.03.25
ORACLE CHR()  (0) 2020.03.25
ORACLE CEIL()  (0) 2020.03.24
ORACLE AVG()  (0) 2020.03.24
ORACLE ATAN2()  (0) 2020.03.24
ORACLE ATAN()  (0) 2020.03.24
ORACLE ASIN()  (0) 2020.03.24
Comments