Home » SQL & PL/SQL » SQL & PL/SQL » type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables
icon5.gif  type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283471] Tue, 27 November 2007 05:00 Go to next message
senganga
Messages: 15
Registered: November 2007
Location: South Africa
Junior Member

Hi, I have the above mention error, I dont know what to do anymore. Please help...

create or replace
FUNCTION XXFIND_LOAD (p_route_in IN  VARCHAR2) RETURN XXLOAD_TYPE_PKG.refcursor
IS
      TYPE refcursor IS REF cursor;
      load_cv refcursor;

CURSOR load_cur 
IS
SELECT  
       ... (LONG LIST)
FROM
       ... (MULTIPLE TABLES)
WHERE
       ...
BEGIN      
      OPEN load_cur;
      FETCH load_cur INTO load_cv;
      close load_cur;
  RETURN load_cv;
END; 

Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283475 is a reply to message #283471] Tue, 27 November 2007 05:11 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
And what don't you understand in "type mismatch"?

You fetch data into a ref cursor.

Regards
Michel

[Updated on: Tue, 27 November 2007 05:12]

Report message to a moderator

Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283481 is a reply to message #283475] Tue, 27 November 2007 05:24 Go to previous messageGo to next message
senganga
Messages: 15
Registered: November 2007
Location: South Africa
Junior Member

I understand that my load_cur is of diferent type to load_cv vareable, however I have made my load_cv to be of type cursor.

How do I make sure that the type are a match?
Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283482 is a reply to message #283481] Tue, 27 November 2007 05:27 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Fetch into = put values into variables.
This is not what you did.
You did: put values into a ref cursor.

Regards
Michel
Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283484 is a reply to message #283471] Tue, 27 November 2007 05:31 Go to previous messageGo to next message
srinivasreddy777
Messages: 11
Registered: October 2007
Location: Hyderabad
Junior Member

Hi..

Just change
load_cv refcursor;
to
load-cv refcursor%rowtype;

Hope this could be work for u.

Regards,

Srinivas
Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283485 is a reply to message #283482] Tue, 27 November 2007 05:34 Go to previous messageGo to next message
senganga
Messages: 15
Registered: November 2007
Location: South Africa
Junior Member

I just did according to the notes, my understanding is that I am opening a cursor then fetch the record from the cursor into my vareable. I tried to make my vareable type to be the same as my cursor...

What is the ridght procedure or the right sintext
Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283488 is a reply to message #283485] Tue, 27 November 2007 05:42 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:

I just did according to the notes,

Which notes?

If you want to return a ref cursor for you query, you just have to open the ref cursor for the query.
Fetches are done in the calling application.

Regards
Michel
Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283493 is a reply to message #283471] Tue, 27 November 2007 05:51 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

Else If you really wants to return ref cursor ,

Then you can try something like..

create or replace
FUNCTION XXFIND_LOAD (p_route_in IN  VARCHAR2) RETURN XXLOAD_TYPE_PKG.refcursor
IS
      TYPE refcursor IS REF cursor;
      load_cv refcursor;

BEGIN      
      OPEN load_cv for SELECT ......; 
  RETURN load_cv;

END; 


And you need to fetch this from calling procedure.

Thumbs Up
Rajuvan.
Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283494 is a reply to message #283471] Tue, 27 November 2007 05:52 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

Oooops... Michel first Sad

Thumbs Up
Rajuvan.
Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283500 is a reply to message #283494] Tue, 27 November 2007 05:58 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
I prefer to give clues and let find by oneself then the solution is in the head for ever.

Regards
Michel

Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283505 is a reply to message #283471] Tue, 27 November 2007 06:04 Go to previous messageGo to next message
scorpio_biker
Messages: 154
Registered: November 2005
Location: Kent, England
Senior Member
Hi,

Have a read here.

I'm still learning about ref cursors and I thought it explained it quite clearly with the examples given.
icon14.gif  Re: type mismatch found at 'LOAD_CV' between FETCH cursor and INTO variables [message #283507 is a reply to message #283488] Tue, 27 November 2007 06:10 Go to previous message
senganga
Messages: 15
Registered: November 2007
Location: South Africa
Junior Member

Thanks to all of you... I had never used a cursor before! Smile
Previous Topic: Please fine tune my query
Next Topic: Period to Period Comparison
Goto Forum:
  


Current Time: Sat Feb 15 16:37:51 CST 2025