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

Home -> Community -> Usenet -> c.d.o.misc -> Re: CURSOR

Re: CURSOR

From: Ricky Sanchez <rsanchez_at_more.net>
Date: Sat, 01 Dec 2001 15:11:14 GMT
Message-ID: <3C08F33A.F709650@more.net>


Allan-

As I read your question, you seem to be asking for a technique to generate a where clause for a statement after the statement has returned its result set. I don't think you really meant it that way, so I will assume you have some other sql statement "b" that gets information used to determine the predicate of the sql statement "a" in question, right?

If so, you need to read up on the dbms_sql package. It permits dynamic sql to be built on the fly. Alternatively, in 8i or higher, you can construct a sql statement in a string and do an "execute immediate" in PL/SQL. To complex to offer a tutorial here, but do read the "supplied pl/sql packages" book in the doc set, check the technical network site for examples, and lookup "execute immediate" in the regular plsql docs.

Allan Martin wrote:
>
> Hi,
>
> I'm trying to write a cursor which has a where clause in it. However, the
> where condition is not discovered until later in the script. How do I make
> the cursor only compile after the select has taken place that finds the
> condition. I don't want to store this as a stored procedure, I just need it
> as a sql script.
>
> Thanks in advance.
>
> Allan Martin
Received on Sat Dec 01 2001 - 09:11:14 CST

Original text of this message

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