Lets say I have a table with an ID and a PARENT_ID.
I want to create an “on update” trigger, so whenever ID is updated, any PARENT_ID which pointed to that ID is also updated.
The main issue I can see with this however is that I don’t think Oracle allows you to select from a table which a trigger is currently executing on.
I know I could just wrap the “update” code in a PL/SQL function, but I have users which are probably more comfortable manipulating this data with just SQL.
What’s the best way to achieve what I’m after without forcing the user to call to much PL/SQL (I’m happy to implement it with PL/SQL obviously, as long as it’s fairly transparent to the user).
I ended up achieving this by basing a view on the table and then making the view updatable by using an
instead oftrigger. This instead of trigger did the appropriate updates to theids andparent_ids in the base table.