Retrive a cursor from a package [message #173566] |
Tue, 23 May 2006 04:00 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
axehigh
Messages: 9 Registered: March 2006
|
Junior Member |
|
|
Hi guys.
I need to have a dynamic sql statement in a package (not in forms because of the percentile limitation). The package will generate a sql statement with the percentile_cont keyword and forms cannot compile that.
Based on some parameters I am passing down, I need to generate the WHERE-statement and return the cursor so that I can iterate through it and populate a block.
Currently I have tried to use a weak referenced cursor, but I seem to run into problems. Constanlty getting an invalid cursor error message or invalid pointer(ORA-01001)
I am able to use the OPEN FOR statement and returning this cursor, but unfortunately this cursor is a bit too static since I need to pass some variables to the cursor.
The simplest form of my cursor is like this:
OPEN o_cur FOR 'select 1,2,3,4 FROM tbl_ name WHERE varenr = :i' USING i_varenr;
where i_varenr is a variable I am passing to the procedure and o_cur is the cursor name that will be passed out from the procedure.
What am I doing wrong?
[Updated on: Tue, 23 May 2006 04:04] Report message to a moderator
|
|
|
Re: Retrive a cursor from a package [message #173588 is a reply to message #173566] |
Tue, 23 May 2006 05:10 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
axehigh
Messages: 9 Registered: March 2006
|
Junior Member |
|
|
This is basically what I would like to accomplish,
CREATE OR REPLACE PROCEDURE get_my_cursor
(p_column IN <your choice>,
p_table IN <your choice>,
p_predicate IN <your choice>,
p_jobid IN dept.jobid%TYPE,
p_cursor OUT SYS_REFCURSOR)
sql_stmt VARCHAR2(1000);
job_rec dept%ROWTYPE;
BEGIN
sql_stmt := 'SELECT job_name, :c
FROM :t
WHERE :w > :j';
OPEN p_cursor FOR sql_stmt
USING p_column, p_table, p_predicate, p_jobid;
..
END;
This is taken from this site: http://www.freelists.org/archives/oracle-l/06-2004/msg01054.html
Now, I'd like to take the p_cursor and use this is Forms 6i. Is this possible?
thanks
[Updated on: Tue, 23 May 2006 05:11] Report message to a moderator
|
|
|
Re: Retrive a cursor from a package [message #173642 is a reply to message #173566] |
Tue, 23 May 2006 13:05 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
RJ.Zijlstra
Messages: 104 Registered: December 2005 Location: Netherlands - IJmuiden
|
Senior Member |
|
|
Hi axehigh,
Sorry not to be able to answer you here, but the phrase in your message 'not in forms because of the percentile limitation' caught my attention.
Could you explain what is meant by this? I currently work in a shop with Forms 5 ( yes I know...), and they have a conviction set in concrete, that they must code anything in forms itself. (preferably in triggers, I suppose even program-units/libraries are more or less suspect in their eyes..). The mentioning of a thing like 'package' will freeze them up, because they heard ( and of course 'know') that ...(you fill in anything that pops up now)
Any extra reason to code as far as possible in packages will be very much appreciated bu me, therefore the question to elaborate a bit on this.
Thanks in advance,
Regards,
Rob Zijlstra
|
|
|
|