Author Topic: Assign the return cursor of a procedure to another cursor (pl/sql)  (Read 1196 times)

0 Members and 1 Guest are viewing this topic.

Offline AdamTopic starter

  • Guru
  • Fanatic
  • *
  • Posts: 4,699
  • Gender: Male
    • View Profile
Hey up. I'm quite stuck on this after playing around with it for about five hours. Basically I'm working on a pretty extensive Oracle framework, trying to use 1 procedure to populate a cursor in my procedure.

So I build up a list of IDs within a cursor:

Code: [Select]
  cursor cPages is
    -- get a list of matching pages
    select pages.page_id
    from (....)

That part's no problem. But later I want to loop through the cursor, calling a procedure to populate another cursor. So far I've been trying:

Code: [Select]
  -- get the page information for each page
  for vPage in cPages loop
    getPage(vPage.page_id, pSitecode, pLang, pAuthLevel, cResults, cLocale);
  end loop;

Currently this does work but only returns the last page - obviously must be overwriting the cursor each time.

Could somebody please point out what I'm doing wrong?

Thanks a lot for any help you can give!

Adam
« Last Edit: May 17, 2010, 06:10:31 AM by MrAdam »
Ronnie Wood, true or false?

Offline AdamTopic starter

  • Guru
  • Fanatic
  • *
  • Posts: 4,699
  • Gender: Male
    • View Profile
Re: Assign the return cursor of a procedure to another cursor (pl/sql)
« Reply #1 on: May 17, 2010, 06:10:04 AM »
Sorry to be more clear, "cResults" in the procedure call is the cursor I'm trying to populate with the page information.
« Last Edit: May 17, 2010, 06:10:38 AM by MrAdam »
Ronnie Wood, true or false?

Offline AdamTopic starter

  • Guru
  • Fanatic
  • *
  • Posts: 4,699
  • Gender: Male
    • View Profile
Re: Assign the return cursor of a procedure to another cursor (pl/sql)
« Reply #2 on: May 17, 2010, 10:15:23 AM »
From what I've read it's impossible to append or merge anything into a cursor in that way. Normally I'd use a join for something like this, but obviously as it's calling another procedure I can't, and the code within that procedure is about 100 lines long so I can't really just duplicate it. Can anybody suggest a work-around that would allow me to achieve the same thing?

Thanks
Ronnie Wood, true or false?