Forum Stats

  • 3,757,137 Users
  • 2,251,200 Discussions
  • 7,869,739 Comments

Discussions

Triggers: treat :old and :new as ROWTYPE

Thorsten Kettner
Thorsten Kettner Member Posts: 39 Red Ribbon
edited Nov 26, 2020 12:24PM in Database Ideas - Ideas

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.)

Thorsten KettnerSven W.Niels HeckerRainer StenzelWilliam RobertsonMarwimsdstuberUser_ZDBVN
8 votes

Active · Last Updated

Comments