Dynamic sql statements

From: <rmarkd_at_my-deja.com>
Date: 2000/07/26
Message-ID: <8lnen1$2ni$1_at_nnrp1.deja.com>#1/1


All, (this is a bit long)

I was wondering if there was a general way of taking a SQL statement which is a string parameter, and returning the values in a delimited format. So, for instance, say I have a table called customers:

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 I can later pull data from. I'm looking at DBMS_SQL.Parse, but I don't think that'll do it. Any suggestions?

Thanks,
Mark

-Mark

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Jul 26 2000 - 00:00:00 CEST

Original text of this message