Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> More help on Dynamic SQL
Hi,
Several people responded my previous post regarding passing a field name to a stored procedure. And all said that I should use DBMS-SQL package. I have tried this package, if I pass a table name, I have no problem, But when I try passing fieldname, before you have the statement
dbms_sql.execute(mycursor);
You need to call
dbms_sql.define_column(...),
since the field is unknown, its type is unknown, so how should I go about call define_column?
Thanks for your help. If you get confused about my words, here is my original post.
Biao Cheng (Sam) wrote:
>
> Hi,
>
> I have a question to ask:
>
> I need to create a stored procedure which contains a string
> type parameter, say
>
> CREATE OR REPLACE proc_1(fieldname CHAR)
> ....
>
> Now, suppose the actual parameter I am passing is a field
> name in a table, my question is How I am able to run a
> SQL statement, something like this:
>
> SELECT "fieldname" from table1;
>
> Is there any way to do this? Any input is highly appreciated.
Received on Tue Mar 25 1997 - 00:00:00 CST