Home » SQL & PL/SQL » SQL & PL/SQL » Problem with ref cursors as out parameter
Problem with ref cursors as out parameter [message #290240] Fri, 28 December 2007 02:57 Go to next message
vishalaksha
Messages: 16
Registered: September 2007
Junior Member
I am using oracle 9.2.0.5.0.
I have created two procedures ORDER_RETURN1 and ORDER_RETURN2
I am calling ORDER_RETURN1 from ORDER_RETURN1 and I am getting following error

begin ORDER_RETURN2; end;

ORA-00932: inconsistent datatypes: expected CURSER got NUMBER
ORA-06512: at "APPS.ORDER_RETURN1", line 8
ORA-06512: at "APPS.ORDER_RETURN2", line 4
ORA-06512: at line 1


Below are the used procedures

CREATE OR REPLACE PROCEDURE ORDER_RETURN1(p_order OUT sys_refcursor) IS
TYPE OE_ORDER_rcur IS REF CURSOR;
rcur OE_ORDER_rcur;
BEGIN
OPEN rcur FOR
SELECT ORDER_NUMBER FROM OE_ORDER_HEADERS_ALL WHERE ROWNUM < 4;
FETCH rcur INTO p_order;
CLOSE rcur;
END ORDER_RETURN1;


CREATE OR REPLACE PROCEDURE ORDER_RETURN2 IS
OE_ORDER_rcur11 sys_refcursor;
BEGIN
ORDER_RETURN1(OE_ORDER_rcur11);
end;


Please help me in solving this issue.
Thanks in advance.
Re: Problem with ref cursors as out parameter [message #290243 is a reply to message #290240] Fri, 28 December 2007 03:12 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
Could you please tell us what you are trying to do rather than helping you out to solve this problem. To be honest i am not able to understand what you are trying to achieve. To start with by looking at the code you have to read the oracle pl/sql reference manual and search for Ref Cursor. You will examples there. Because I don't think you have understood what a Ref Cursor is. I am sorry for being rude but your code is all over the place.

Regards

Raj

[Updated on: Fri, 28 December 2007 03:14]

Report message to a moderator

Re: Problem with ref cursors as out parameter [message #290248 is a reply to message #290243] Fri, 28 December 2007 03:25 Go to previous messageGo to next message
vishalaksha
Messages: 16
Registered: September 2007
Junior Member
Hi
I have two procedures named ORDER_RETURN1 and ORDER_RETURN2.
In procedure ORDER_RETURN1 I am using a out parameter as ref cursor and I am collecting order numbers in this out parameter.
Now in procedure ORDER_RETURN2 I am just calling ORDER_RETURN1.
When I execute procedure ORDER_RETURN2 following error occurs

ORA-00932: inconsistent datatypes: expected CURSER got NUMBER
ORA-06512: at "APPS.ORDER_RETURN1", line 8
ORA-06512: at "APPS.ORDER_RETURN2", line 4
ORA-06512: at line 1

This is all about my problem.
Re: Problem with ref cursors as out parameter [message #290256 is a reply to message #290248] Fri, 28 December 2007 03:49 Go to previous message
Michel Cadot
Messages: 64108
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Your error is quite clear:
Quote:

expected CURSER got NUMBER

Quote:

OE_ORDER_rcur11 sys_refcursor

Quote:

FETCH rcur INTO p_order;

You tried to put ORDER_NUMBER into a ref cursor.

I suggest you to search for "ref cursor" in the documentation (or here) to see how to use it.

Regards
Michel

[Updated on: Fri, 28 December 2007 03:49]

Report message to a moderator

Previous Topic: A problem with UTL_FILE and cursor
Next Topic: How to share a context
Goto Forum:
  


Current Time: Mon Dec 05 04:54:52 CST 2016

Total time taken to generate the page: 0.17219 seconds