Cursor is Out of Scope [message #334875] |
Fri, 18 July 2008 08:44  |
AlKing
Messages: 11 Registered: July 2008 Location: Bakersfield
|
Junior Member |
|
|
I keep getting this error everytime and I really don't know how to fix it. Can someone please help
here's error
****************************************************************
ORA-06550: line 43, column 21:
PLS-00225: subprogram or cursor 'cREC' reference is out of scope
****************************************************************
See the attached file for the code refered. Please someone help
-
Attachment: orAl.txt
(Size: 0.96KB, Downloaded 809 times)
|
|
|
|
|
Re: Cursor is Out of Scope [message #334882 is a reply to message #334875] |
Fri, 18 July 2008 09:21   |
AlKing
Messages: 11 Registered: July 2008 Location: Bakersfield
|
Junior Member |
|
|
Anacedent,
In the cursor, it only pulls so many records..its about 11, so when it starts writing them out in the for loop, whenever there is nothing else to pull from the cursor the loop ends.
|
|
|
|
|
Re: Cursor is Out of Scope [message #334887 is a reply to message #334875] |
Fri, 18 July 2008 09:36   |
scorpio_biker
Messages: 154 Registered: November 2005 Location: Kent, England
|
Senior Member |
|
|
Assuming I'm not missing the point here (given its Friday afternoon of a poor week) should it not be
instead of
FOR REC IN cREC LOOP
V_COUNT := V_COUNT + 1;
SELECT COMPANY
INTO V_COMPANY
FROM myTransactions
WHERE COMPANY = cREC.COMPANY; /*It does not like this line*/
DBMS_OUTPUT.PUT_LINE(' REPORTS CREATED FOR - ' ||V_COMPANY);
END LOOP;
|
|
|
Re: Cursor is Out of Scope [message #334888 is a reply to message #334882] |
Fri, 18 July 2008 09:41   |
AlKing
Messages: 11 Registered: July 2008 Location: Bakersfield
|
Junior Member |
|
|
Anacedent,
I guess I could say if cRec%NOTFOUND get out or something like that. However my main concern right now is that it complains that
WHERE COMPANY = cREC.COMPANY;
is out of scope.
I have tested the sql statements and it only gives me so many records. So can you or anyone else please help with the out of scope error and how I would refer to cRec within the "for loop" so I can pass the records into the for loop?
Thank you.
|
|
|
Re: Cursor is Out of Scope [message #334889 is a reply to message #334888] |
Fri, 18 July 2008 09:45   |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
Assuming that you are only using this code as a learning tool and do not intend using it in a production environment, surely you would be better served to actually try to learn what is required rather than looking for someone to spoon feed you the answer. By carefullyreading the link that I provided, the answer should become apparent.
|
|
|
|
Re: Cursor is Out of Scope [message #334892 is a reply to message #334888] |
Fri, 18 July 2008 10:00   |
AlKing
Messages: 11 Registered: July 2008 Location: Bakersfield
|
Junior Member |
|
|
Pablolee,
I see what are you saying, this code is not as small as I provided there, its a massive production in an actual work environment. Code was written in separate files by different people and I get to put it all together and automate the process in Oracle and sometimes a small error can seem big at least to me especially when you are dealing with someone else's code. Everyone has their own style and I have never dealt with cursors before....so i was not looking to be spoon fed and I bet you've had to ask for help before.
|
|
|
|
|
Re: Cursor is Out of Scope [message #334898 is a reply to message #334892] |
Fri, 18 July 2008 10:13   |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
Quote: | this code is not as small as I provided there
| Little note to allude to that at the start may prove useful.
Quote: | its a massive production in an actual work environment
| Then unless you are working in an old and unsupported version, a cursor loop would probably be the wrong way to go.
Quote: | so i was not looking to be spoon fed
| Sorry, but I disagree, I posted a link to a resource that would have helped you solve the issue yourself, but you decided to ignore it and continue asking for assistance.
Quote: | and I bet you've had to ask for help before.
| Many, many times, but when I do, I post an accurate representation of what I am actually trying to do, and as soon as someone posts a link to a resource that should point me in the direction of what I need to do, I will stop, read through the link, try myself and if I am still unable to resolve, come back and show what I have attempted and ask for further clarification.
[Updated on: Fri, 18 July 2008 10:14] Report message to a moderator
|
|
|
|
|