Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

null dates- how to convert to other string

WestDraytonMar 3 2010 — edited Mar 3 2010
What is the best way to convert empty value of DATE datatype to string "empty date".

I do at the moment so:
with t
as
(
select current_date d from dual
union 
select null from dual)
select t.d, nvl(to_char(t.d),'empty date') a/*, nvl(t.d,'empty date') b*/ from t;


--
03.03.2010	03.03.2010
(null)	                empty date
If i tried to display commented column b there, but i got error:
"ORA-01858: a non-numeric character was found where a numeric was expected"


So, is the best way to display for null dates other string like "empty date" the way i do in column "a"?
Or is there better way?
This post has been answered by Frank Kulash on Mar 3 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 31 2010
Added on Mar 3 2010
4 comments
11,342 views