Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> TO_DATE does not work inside PLSQL cursor???
Hi fellas.
Had this problem in older versions of ORACLE. Looks like it's still there in 8.0.6...
SELECT f1,f2,count(f3)
FROM T1
WHERE F3 BETWEEN TO_DATE('01021996140000','ddmmyyyyhh24miss')
AND TO_DATE('01022001140000','ddmmyyyyhh24miss')AND F1 > 100
DECLARE
cursor c1 is
SELECT f1,f2,count(f3)
FROM T1
WHERE F3 BETWEEN TO_DATE('01021996140000','ddmmyyyyhh24miss')
AND TO_DATE('01022001140000','ddmmyyyyhh24miss')AND F1 > 100
this doesn't execute at all, comes back with syntax error, PLS-0222, "TO_DATE is not valid function in this context" or words to the same effect...
DECLARE
l_date_from DATE := TO_DATE('01021996140000','ddmmyyyyhh24miss');
l_date_to DATE := TO_DATE('01022001140000','ddmmyyyyhh24miss');
cursor c1 is
SELECT f1,f2,count(f3)
FROM T1
WHERE F3 BETWEEN l_date_from
AND l_date_to
then all is allright.
Weird, eh?
Had this in V6, V7. Now it's also there in 8.0.6? Any ideas if there is a fix? Or am I doing something obscure that I'm not aware of? To the best of my knowledge, TO_DATE is a valid SQL function in ANY context! If I replace the TO_DATE with other functions in other examples, then it works fine. It's not the BETWEEN either, happens with <=||>= too.
TIA for any help out there.
Cheers
Nuno Souto
nsouto_at_bigpond.net.au.nospam
http://www.users.bigpond.net.au/the_Den/index.html
Received on Fri Dec 08 2000 - 06:35:55 CST