Oracle SQL - Function CAST function

Introduction

CAST function is a generic conversion function.

It allows you to convert any expression to any specific data type, including the option to specify a data type precision.

Demo

SQL>
SQL> select cast(12.98 as number(2)) example1
  2  ,      cast('oak' as char(10) ) example2
  3  ,      cast(null  as date     ) example3
  4  from   dual;

 EXAMPLE1 | EXAMPLE2   | EXAMPLE3-- from w ww. ja v  a  2  s . c o m
--------- | ---------- | ---------
 00013.00 | oak        |  [N/A]

SQL>