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

Home -> Community -> Usenet -> c.d.o.tools -> Dynamic SQL statements

Dynamic SQL statements

From: <rmarkd_at_my-deja.com>
Date: 2000/07/27
Message-ID: <8lpo7g$ot1$1@nnrp1.deja.com>#1/1

(Note: I posted this to c.d.o.tools previously. I think that was the wrong newsgroup. Hopefully this is the right one)

All,

I was wondering if there was a general way in a PL/SQL function where you take an SQL statement as an IN parameter and return a string that is the output of that SQL statement. For instance, say I have a table called...

CUSTOMERS (firstname varchar2(10), zip number(5))

And let's say I wanted to get all the information in a semi-colon delimited format (pipe delimiter separating the records) for those people in zip 94000. I would say something like "select firstname, zip from customers where zip between 94000 and 95000".

Is there a procedure that will take in that statement as a parameter and return something like this?
Mark;94000|homer;94001|tyler;94505

I know how to create the string once I have the sql statement, what I don't know is how to take the IN parameter and turn that into a SQL statement which PL/SQL can parse and execute. I'm looking at DBMS_SQL.Parse, but I don't think that'll do it. Any suggestions?

Thanks,
Mark

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Jul 27 2000 - 00:00:00 CDT

Original text of this message

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