Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Ref Cursor question
Thank you for your reply, Mathias.
However, first of all, I get an error msg, PLS-00320, when I try to run the following statement ( even though the SELECT statement works fine in SQLPLUS):
CREATE OR REPLACE PROCEDURE RETURN_RESULT_SET
(oCursor IN OUT MyPkg.CursorType) as
BEGIN
open oCursor for
select max(decode(hits,null, null, hits)),
max(decode(cnt_hits, null, null, cnt_hits)), max(decode(smg, null, null, smg)), max(decode(cnt_smg, null, null, cnt_smg))from
And secondly, pls clarif your statement that
You can pass a paramter that is used _in_ the WHERE-clause, but not as
WHERE-clause:
Perhaps an example of this using a cursor type. My goals is a procedure of
this type:
CREATE OR REPLACE PROCEDURE RETURN_RESULT_SET (oCursor IN OUT MyPkg.CursorType,
AColumn IN VARCHAR, AValue IN VARCHAR) as
select * from ATable where AColumn like AValue||% END; Matthias Gresz wrote:
> PMG schrieb:
> >
> > This is a multi-part question.
> >
> > I am trying to "flatten" out a query -- that is rotating rows to columns
> > (I forget the technical term for it). Anyway, it's a two step process,
> > first a query consisting of a series of unions, and then a query which
> > does a series of MAX(DECODE(...)) statements.
> >
> > I would like to incorporate this into a stored procedure in order to
> > speed it up, hopefully.
> >
> > My questions are: 1). Given the standard way of using Ref Cursors,
> > CREATE PACKAGE MYPKG
> > IS
> > TYPE CursorType IS REF CURSOR;
> > END MyPkg;
> > /
> > CREATE PROCEDURE RETURN_RESULT_SET
> > (oCursor IN OUT MyPkg.CursorType) AS
> > BEGIN
> > open oCursor for select * from employees;
> > END;
> >
> > can one modify this to first generate a cursor holding the intermediate
> > query, and then have oCursor refer to the first cursor? Can this be done
> > in 7.1? 7.3?
>
>> ;
> SELECT
> max(decode(u.field1,...)) a,
> max(decode(u.field1,...)) b,
> ...
> FROM
> (SELECT
> *
> FROM
> ... your_union
> ) u
> WHERE
> blahblah
>> > My last question is actually a confirmation -- that a cursor ref can not
> >
>
>> > a parameter to be used in the WHERE clause?
> > Specifically, can I pass in
>
>> ;
> SELECT
> ...
> WHERE
> t.Myfield=p_param1
>
>
![]() |
![]() |