Re: Dynamic SQL Cursors

From: Simon Hedges <shedges_at_hhhh.freeserve.co.uk>
Date: Sat, 6 Nov 1999 19:09:31 -0000
Message-ID: <803die$8nr$1_at_news4.svr.pol.co.uk>


[Quoted] Thomas Kyte <tkyte_at_us.oracle.com> wrote in message news:LBgjOL=A12UbX1T2m+OP4oywI9+U_at_4ax.com...
> A copy of this was sent to "Chad Sheley" <csheley_at_usa.capgemini.com>
> (if that email address didn't require changing)
> On Fri, 5 Nov 1999 11:11:48 -0600, you wrote:
>
> >I am fairly knew to the PL/SQL / Oracle world, but have become pretty
> >familiar with a couple of concepts: returning a cursor from a function or
> >stored procedure AND dynamic SQL.
> >
> >Now... I want to combine the 2 concepts. I want to dynamically create a
SQL
> >statement and then return a cursor object from my function that creates
the
> >statement. As near as I can tell, the dynamic SQL package (DBMS_SQL)
> >identifies the cursor with an integer variable, not a cursor object.
> >
> >How can I reference a cursor object created from a dynamic SQL statement.
> >
>
> you cannot until Oracle8i, release 8.1

It's possible that you can create a view using dynamic SQL, and then base the cursor on selecting from the view. This would, of course, not be possible if the view was completely different each time it was created, but if the view (on recreation) had an identical (or very similar) structure,
[Quoted] with identical column names , then you might get away with it. I think it would certainly work if all you needed to do was to change the where clause dynamically.

Simon Hedges
Gloucester
UK Received on Sat Nov 06 1999 - 20:09:31 CET

Original text of this message