Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > Date Column - NULL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-10-03, 00:27
senthil5_kumar senthil5_kumar is offline
Registered User
 
Join Date: Jan 2003
Posts: 18
Date Column - NULL

Hi,
I have a column of Date data type which can accept NULL.
when I query on this column I like to get 'Nil' if the Column is NULL.
So I tried ......
select NVL(date_of_expiry,'Nil')
I got the following error message.
ORA-01858: a non-numeric character was found where a numeric was expected

Can anyone please tell me how to return a string if the date column is NULL.
Thanks in advance.

Regards,
Senthil
Reply With Quote
  #2 (permalink)  
Old 02-10-03, 02:31
NoviceNo1 NoviceNo1 is offline
Registered User
 
Join Date: Jan 2003
Location: Woking
Posts: 107
Re: Date Column - NULL

Quote:
Originally posted by senthil5_kumar
Hi,
I have a column of Date data type which can accept NULL.
when I query on this column I like to get 'Nil' if the Column is NULL.
So I tried ......
select NVL(date_of_expiry,'Nil')
I got the following error message.
ORA-01858: a non-numeric character was found where a numeric was expected

Can anyone please tell me how to return a string if the date column is NULL.
Thanks in advance.

Regards,
Senthil


Hi Senthil,
You are getting this error because your column date_of_expiry
is defined as DATE in the table and the value 'Nil' is not a valid
date.

However you can try this, it will work.

SELECT NVL(TO_CHAR(date_of_expiry),'Nil')
__________________
nn
Reply With Quote
  #3 (permalink)  
Old 02-10-03, 02:35
senthil5_kumar senthil5_kumar is offline
Registered User
 
Join Date: Jan 2003
Posts: 18
Re: Date Column - NULL

Thanks a Lot!!!!!!!!!!!

Regards,
Senthil


Quote:
Originally posted by NoviceNo1
Hi Senthil,
You are getting this error because your column date_of_expiry
is defined as DATE in the table and the value 'Nil' is not a valid
date.

However you can try this, it will work.

SELECT NVL(TO_CHAR(date_of_expiry),'Nil')
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On