Oracle Date Formatting Null date as 00/00/0000

42,662

Solution 1

Do the to_char first and wrap it in the NVL. For example,

select nvl(to_char(null, 'DD-MM-YYYY'), '00-00-0000') from dual

Solution 2

Use this function to assign default values of null values of date:

SELECT id, NVL(start_date, to_date('20020101','YYYYMMDD')) FROM employee;
Share:
42,662
msbyuva
Author by

msbyuva

Updated on November 30, 2021

Comments

  • msbyuva
    msbyuva over 2 years

    How can I format the Null Dates in my Oracle SQL to 00/00/0000. I am using NVL function but it doesn't recognize the 00/00/0000 as the date format.

    Is there any Date Formatting available in Oracle SQL which formats null date to 00/00/0000

  • msbyuva
    msbyuva over 13 years
    Thanks, it worked for me. I didn't thought it was so easy to convert.!! :)
  • Devendra Giri
    Devendra Giri over 2 years
    Date fillter when from and to data is avialable then show only those records other wise all record will show
  • Admin
    Admin over 2 years
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.