//新增字段更改值
create or replace trigger trg_insert_terminal_addr_hex
before insert
on r_tmnl_run
for each row
begin
:new.terminal_addr_hex:=substr(:new.terminal_addr,1,4)|| lpad(trim(to_hex(substr(:new.terminal_addr,5,5))),4,'0') ;
END;
//修改字段赋值
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;
create or replace trigger trg_insert_terminal_addr_hex
before insert
on r_tmnl_run
for each row
begin
:new.terminal_addr_hex:=substr(:new.terminal_addr,1,4)|| lpad(trim(to_hex(substr(:new.terminal_addr,5,5))),4,'0') ;
END;
//修改字段赋值
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;