Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Field names?
You can find a list of column names for a table in a view called
user_tab_columns. But I think you will have lots of other
problems/questions -
Q. How will your routine know which row has changed A. You will need to pass a unique ID for the row
Q. How will you actually query the Table. A. Build a dynamic SQL statement and use DBMS_SQL package.
Q. How will it know what the new values are - these are only visible inside
a trigger
A. You might be able to make two calls, on in a Before Update trigger to get
the Old values and one in an After Update trigger to get the New values -
never tried this, you may get a 'table is mutation' error.
SB
David Younger <david_at_proware.com.au> wrote in message
news:7g0bg5$3mb$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 - 10:47:54 CDT