「Oracle」triggerでカラムを更新するコード

サンプルコード

CREATE OR REPLACE TRIGGER trg_update_terminal_addr_hex

BEFORE UPDATE

ON r_tmnl_run

FOR EACH ROW

DECLARE

BEGIN

if(:old.TERMINAL_ID=:new.TERMINAL_ID)then

:new.terminal_addr_hex:=substr(:new.terminal_addr,1,4)|| lpad(trim(to_hex(substr(:new.terminal_addr,5,5))),4,’0′) ;

end if;

END;

Oracle

Posted by arkgame