Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Triggers: treat :old and :new as ROWTYPE

Thorsten KettnerNov 26 2020 — edited Nov 26 2020

It has been recommended to move trigger code to stored procedures when the code gets large. We would hence create a procedure (stand-alone or inside a package) as

PROCEDURE p_handle_mytable (vi_old mytable%ROWTYPE, vi_new mytable%ROWTYPE) AS
...

Unfortunately, though, we cannot simply

CREATE OR REPLACE TRIGGER trg_mytable
AFTER DELETE OR INSERT OR UPDATE ON mytable
FOR EACH ROW
BEGIN
 p_handle_mytable (:old, :new);
END;

although this is PL/SQL code and :old and :new seem to work exactly as if defined as mytable%rowtype elsewise.
My request: Treat :old and :new as ROWTYPE and make it thus possible to pass :old and :new to a procedure.
(Sorry, if this idea has been suggested before. I've not been able to properly search database ideas in the new forum. Hence I do not know whether this idea has already been proposed.)

Comments
Post Details
Added on Nov 26 2020
3 comments
1,180 views