Oracle SQL - Nest Conversion Functions

Introduction

The following code shows how you can nest conversion functions.

It uses the TO_DATE function to interpret the string '01/01/2018' as a date value.

Then, you use the TO_CHAR function to extract the day from the date value.

Demo

SQL>
SQL>-- from w  ww  . j ava 2 s .c om
SQL> select sysdate                       as today
  2  ,      to_char(sysdate,'hh24:mi:ss') as time
  3  ,      to_char(to_date('01/01/2018','dd/mm/yyyy')
  4                ,'"is on "Day') as new_year_2018
  5  from dual;

TODAY     | TIME     | NEW_YEAR_2018
--------- | -------- | ---------------
14-APR-18 | 09:28:47 | is on Monday

SQL>

Related Topic