Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: pl/sql question
decoy_at_system102.com wrote:
> thanks for the reply. I don't think I gave enough detail in my
> question, what I want is from within a trigger to iterate through the
> fields of the new row:
>
> CREATE TRIGGER tt
> AFTER INSERT ON table1
> REFERENCING NEW AS newRow
> FOR EACH ROW
> BEGIN
> /* Somehow iterate through each of the fields in newrow,
> without knowing their
> names*/
> END tt;
> .
> run;
Querying user_tab_columns springs to mind, though I must say that doing so in a trigger seems a monumentally bad idea.
This would add a *lot* of overhead for each row inserted.
Assuming you have a good reason for doing this in a trigger, a better solution might be to write SQL that generates the SQL for the trigger with all the column names already coded in the trigger.
This too would add overhead, but substantially less than scanning user_tab_columns for every row.
In any case, you should prototype this and see if you can live with the performance overheaad. Received on Mon Sep 26 2005 - 15:32:51 CDT