Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Dynamic cursor definition

Re: Dynamic cursor definition

From: Mark D Powell <mark.powell_at_eds.com>
Date: 14 Aug 2002 06:12:24 -0700
Message-ID: <178d2795.0208140512.3090e1bf@posting.google.com>


"Jan Gelbrich" <j_gelbrich_at_westfalen-blatt.de> wrote in message news:<ajcupb$1al1ba$1_at_ID-152732.news.dfncis.de>...
> Hello,
>
> I would like to ask if there is a way to declare a cursor dynamically. In my
> case I want to have a dynamic ORDER BY
> clause at the end of a Cursor - the entire rest of the cursor and the
> procedure should not be altered.
>
> As far as I did not know how to do it, I made 2 prodecures which only
> difference is the ORDER BY in the cursor.
> But this is a bad design of course, I would appreciate Your help.
>
> ThanX in advance,
>
> Jan Gelbrich

Jan, I believe you could use a reference cursor in one procedure instead of two different explicitly defined SQL cursors, each in its own procedure. The version 8 plsql manual has examles of executing a different SQL statement for the cursor based on a passed in condition.

Also I believe using a weakly typed cursor you could define just one cursor and have a more or less dynamic cursor. I could not find my example but if you search this groups archives for 'reference cursor' and 'weakly typed' you should have a good chance of finding an example.

HTH -- Mark D Powell -- Received on Wed Aug 14 2002 - 08:12:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US