Skip Headers
Oracle® OLAP Expression Syntax Reference
Release 11.2

Part Number E23381-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

CAST

CAST converts values from one data type to another.

Return Value

The data type specified by type_name.

Syntax

CAST(expr AS type_name)

Arguments

expr can be an expression in one of the data types.

type_name is one of the data types listed in Table 1-2, "Dimensional Data Types".

Table 3-1 shows which data types can be cast into which other built-in data types. NUMBER includes NUMBER, DECIMAL, and INTEGER. DATETIME includes DATE, TIMESTAMP, TIMESTAMP WITH TIMEZONE, and TIMESTAMP WITH LOCAL TIMEZONE. INTERVAL includes INTERVAL DAY TO SECOND and INTERVAL YEAR TO MONTH.

Table 3-1 Compatible Data Types

From To BINARY_FLOAT, BINARY_DOUBLE To CHAR, VARCHAR2 To NUMBER To DATETIME, INTERVAL To NCHAR, NVARCHAR2

BINARY_FLOAT, BINARY_DOUBLE

yes

yes

yes

no

yes

CHAR, VARCHAR2

yes

yes

yes

yes

no

NUMBER

yes

yes

yes

no

yes

DATETIME, INTERVAL

no

yes

no

yes

yes

NCHAR, NVARCHAR2

yes

no

yes

no

yes


Example

CAST('123.4567' AS NUMBER(10,2)) returns the value 123.46.