Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 7th, 2004, 10:14 AM
tatochka tatochka is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 tatochka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ORA-01847 day of month must be between one and last day of month

This is really driving me crazy. I run the simple select statement from PL SQL of Oracle database.
field ml504.adj_paid_to_date is a number(8) format.

select to_date(ml504.adj_paid_to_date, 'yyyymmdd')
from ml504


This one runs fine (no errors) meaning the date format is OK.

Now when I add :

select to_date(ml504.adj_paid_to_date, 'yyyymmdd')
from ml504
where extract(month from to_date( ml504.adj_paid_to_date, 'yyyymmdd')) = 1
brings me the above mentioned error for every month I select.

I would appriciate any help on this. Thanks.

Reply With Quote
  #2  
Old October 7th, 2004, 10:29 AM
utecistu utecistu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 16 utecistu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
u have records in ml504 where adj_paid_to_date has the last 2 digits not between first and last day of that month.

Reply With Quote
  #3  
Old October 7th, 2004, 11:19 AM
tatochka tatochka is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 tatochka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If it was so why to_date function didn't return any errors?
Anyway i changed the stament to :

select to_date(ml504.adj_paid_to_date, 'yyyymmdd')
from ml504
where
substr(to_char(ml504.adj_paid_to_date), 7, 2) = '12' and
extract(month from to_date( ml504.adj_paid_to_date, 'yyyymmdd')) = 7


and still got the same error.

Reply With Quote
  #4  
Old October 8th, 2004, 02:19 AM
utecistu utecistu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 16 utecistu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
try to loop through a cursor from ml504 and do a dmbs_output before that select (into a variable) and see at which record u get the error.

Reply With Quote
  #5  
Old November 1st, 2004, 06:00 PM
roger_sprague roger_sprague is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 1 roger_sprague User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
tatochka,

Did you ever get a resolution to this problem? I am experiencing the same behaviour, but do not know what is causing it.

Reply With Quote
  #6  
Old November 2nd, 2004, 03:12 AM
utecistu utecistu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 16 utecistu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by roger_sprague
tatochka,

Did you ever get a resolution to this problem? I am experiencing the same behaviour, but do not know what is causing it.


declare
cursor c is select rownum r, adj_paid_to_date from ml504;
data varchar2(8);
r number(10);
begin
for i in c loop
data:=i.adj_paid_to_date;
r:=i.r;
select extract(month from to_date(i.adj_paid_to_date,'yyyymmdd')) into data from dual;
end loop;
exception
when others then
dbms_output.put_line('row: '||r||' date: '||data);
end;

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > ORA-01847 day of month must be between one and last day of month


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway