|
|
|
|
|
|
Re: Date Function Ora-01841(full) year must be between [message #510870 is a reply to message #510849] |
Wed, 08 June 2011 02:58 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
s197oo302 wrote on Wed, 08 June 2011 07:57
SMS_CLC is VARCHAR2 and my senior force me to use VARCHAR2 instead of DATE because he think it is faster than use DATE to column format.
Your senior doesn't have a clue what he's talking about.
If you only have one date format, then you can avoid format conversions sure, but they're lightning fast anyway.
However you promptly stop oracle from doing all sorts of date optimisations when looking up data. Oracle knows how many hours are in a day, how many days in a month etc. It can use that information to help speed up date searchs. But only if it knows that the data it's looking at is a date.
And of course you lose the ability to do any and all date arithmatic - or you will be doing format conversions anyway.
|
|
|
Re: Date Function Ora-01841(full) year must be between [message #563221 is a reply to message #510177] |
Fri, 10 August 2012 01:39 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/4004971607c84907ac946aa6e8afb5d8?s=64&d=mm&r=g) |
rjobaan
Messages: 1 Registered: August 2012
|
Junior Member |
|
|
I have also the same error message
When I run the following query:
select DISTINCT
A.WACHT,
to_date(to_char(A,'dd-mm-yyyy HH24:MI:SS'),'dd-mm-yyyy HH24:MI:SS'),
B.START,
B.END,
B.START-(10/(24*60)),
B.END-10/(24*60)
from DIM_TIME B
INNER JOIN RAP A
ON to_date(to_char(A.WACHT,'dd-mm-yyyy HH24:MI:SS'),'dd-mm-yyyy HH24:MI:SS')BETWEEN B.START-10/(24*60) AND B.END-10/(24*60)
where TRUNC(B.START)between '5-8-2012' and '8-8-2012'
No issues
but as soon as i remove the where clause its giving the ORA-1841 error
select DISTINCT
A.WACHT,
to_date(to_char(A,'dd-mm-yyyy HH24:MI:SS'),'dd-mm-yyyy HH24:MI:SS'),
B.START,
B.END,
B.START-(10/(24*60)),
B.END-10/(24*60)
from DIM_TIME B
INNER JOIN RAP A
ON to_date(to_char(A.WACHT,'dd-mm-yyyy HH24:MI:SS'),'dd-mm-yyyy HH24:MI:SS')BETWEEN B.START-10/(24*60) AND B.END-10/(24*60)
If i dive into the code i already get error when running this query
select DISTINCT
B.START,
B.START-(10/(24*60))
from DIM_TIME B
but when adding a where clause its working again??
select DISTINCT
B.START,
B.START-(10/(24*60))
from DIM_TIME B
where TRUNC(B.START)between '5-8-2012' and '8-8-2012'
what am i doing wrong?
|
|
|
|
|