Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


CAST Specification


With the CAST specification it is possible to specify a data type conversion. CAST converts the value of an expression to a specified data type.



Rules

The following rules apply to CAST:


Exact num
Appr. num
Char/
nchar
Date
Time
Time-stamp
Year-Mon
Day-Time
Bool
Bin
Lob
Exact num
Y
Y
Y
N
N
N
Y*
Y*
N
N
N
Approx num
Y
Y
Y
N
N
N
N
N
N
N
N
Char/nchar
Y
Y
Y
Y
Y
Y
Y
Y
Y
N
N
Date
N
N
Y
Y
N
Y
N
N
N
N
N
Time
N
N
Y
N
Y
Y
N
N
N
N
N
Timestamp
N
N
Y
Y
Y
Y
N
N
N
N
N
Year-Month
Y*
N
Y
N
N
N
Y
N
N
N
N
Day-Time
Y*
N
Y
N
N
N
N
Y
N
N
N
Boolean
N
N
Y
N
N
N
N
N
Y
N
N
Binary
N
N
N
N
N
N
N
N
N
Y
N
Lob
N
N
N
N
N
N
N
N
N
N
N

Example

 SELECT CAST(floatcol AS DECIMAL(15,3)),
        CAST(charcol AS VARCHAR(10)),
        CAST(intcol AS CHAR(15)),
        CAST(decimcol AS FLOAT)
 FROM types_tab;

Mimer
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
info@mimer.se
Mimer SQL Documentation TOC PREV NEXT INDEX