Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: dbms_sql question
"Roman Rahimov" <roman_at_santel.ru> wrote in message
news:953a8t$12p9$1_at_serv2.vsi.ru...
> Hello!
>
> > My question is: (how) can I identify the columns that are being
selected?
>
> via dbms_sql.define_column
>
> here is my example
> .........
> source_cursor INTEGER;
> vValue VARCHAR2(2000):='';
> row_processed INTEGER;
> BEGIN
> source_cursor:= dbms_sql.open_cursor;
> dbms_sql.parse(source_cursor,'select object_name from t1 where
> object_no=:vObjectID',1);
> dbms_sql.bind_variable(source_cursor,':vObjectID',pObjectID);
> dbms_sql.define_column(source_cursor, 1, vValue,2000);
> row_processed:=dbms_sql.execute(source_cursor);
> IF dbms_sql.fetch_rows(source_cursor)>0
> THEN dbms_sql.column_value(source_cursor, 1, vValue);
> END IF;
> dbms_sql.close_cursor(source_cursor);
> .........
>
> Good luck!
>
>
Thanks for your assistance, I may not have asked the question quite clear enough : I don't know how many columns are being selected, nor what these columns are, so is there a way to get this information?
e.g. your statement
dbms_sql.define_column(source_cursor, 1, vValue,2000);
is explicitly defining the 1st column of the results of the select statement. I need to repeat this 'n' times (but don't know what value 'n' will be) and identify the column name.
ALTERNATIVELY, i could have completely misunderstood your response :)
Thanks
Jeremy
Received on Mon Jan 29 2001 - 03:47:35 CST