问题
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
回答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
回答2:
Use this function to assign default values of null values of date:
SELECT id, NVL(start_date, to_date('20020101','YYYYMMDD')) FROM employee;
来源:https://stackoverflow.com/questions/4586014/oracle-date-formatting-null-date-as-00-00-0000