Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Field names?
David:
There are a couple of ways you can do this:
first, you can use the user_tab_columns or similar view to
get this data from the data dictionary in the form of a dataset
(one row per field).
second, you can use DBMS_SQL.DESCRIBE_COLUMNS
if you use DBMS_SQL to formulate a query. A common trick
is to create a query like this:
select * from mytable where 1=2
and then execute it. it wont have any rows, but you can use it
to get the fields using DESCRIBE_COLUMNS after the EXECUTE
command.
Hope that helped.
Dave
David Younger wrote in message <7g0a8c$3jn$1_at_news.eisa.net.au>...
>In a PL/SQL script, how can I programatically iterate through all the
fields
>in a table without specifically knowing the field names?
>
>Specifically, I am trying to write a generic auditing function that will be
>triggerd on insert, update and delete that will be passed the table name
and
>will write out all the old/current values of each field.
>
>Thanks
>David Younger
>
>
Received on Mon Apr 26 1999 - 22:48:12 CDT
![]() |
![]() |