Hi,
You cannot use date datatype direct into for loop,
Instead you can do this :
BEGIN
FOR i IN (SELECT (sysdate+2)-sysdate from dual) LOOP
Action.......
END LOOP;
END;
OR
BEGIN
FOR i IN (SELECT column from <table> where <condition> BETWEEN sysdate AND
sysdate+2 ) LOOP
Action.......
END LOOP;
END;
Hope this can solve your problem.
Regards,
Bmal
-----Original Message-----
From: Pitoyo
[mailto:oracledba-ezmlmshield-x79684964.[Email address protected]
Sent: Friday, December 28, 2007 8:17 AM
To: LazyDBA Discussion
Subject: For loop using Date datatype
Hi gurus...
I have a pl/sql block that contains loop. But it doesn't work, it's says
that "wrong of type"
bellow is my code :
for x in sysdate..sysdate + 2 loop -- error in this line
action.......
end loop;
Is it correct that we can't use a date type in loop command ??
Thanks & regards.
Pitoyo
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
Oracle LazyDBA home page