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

Home -> Community -> Usenet -> c.d.o.server -> Re: column name as a part of the result set

Re: column name as a part of the result set

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: 19 Feb 2004 21:21:43 -0800
Message-ID: <1a75df45.0402192121.7acffdd@posting.google.com>


Daniel Morgan <damorgan_at_x.washington.edu> wrote i

> > You can use dynamic SQL and do a DESCRIBE on the cursor to fetch the
> > column names/labels into a dynamic array... and then process it from
> > there (i.e. iterate through column array per row for columns with the
> > same name and then comparing the row's values to see if it is
> > different or not).
> >
> > I'm sure I've seen DESCRIBE supported in PL/SQL (it is an often used
> > Pro*C/OCI function).
> >
> > --
> > Billy
>
> Not according to tahiti.oracle.com though I will gladly stand corrected.

Found it.

Daniel, have a look at example 8 for DBMS_SQL (Oracle9i Supplied PL/SQL Packages and Types Reference)

Something like:
begin
  c := dbms_sql.open_cursor;
  dbms_sql.parse(c, 'select * from scott.bonus', dbms_sql);   d := dbms_sql.execute(c);
  dbms_sql.describe_columns(c, col_cnt, rec_tab); ..etc.

This DESCRIBE function of DBMS_SQL quite likely use the same one we'll use in Pro*C (example 10 of Pro*C I think does this also using dynamic SQL and bind vars).

--
Billy
Received on Thu Feb 19 2004 - 23:21:43 CST

Original text of this message

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