行級觸發(fā)器執(zhí)行多個(gè)語句時(shí)的語句格式
謝謝老師的精彩講解。 有個(gè)問題:就是在執(zhí)行行級觸發(fā)器語句時(shí) 還希望能在sqlplus屏幕上打印相關(guān)信息時(shí) 是在then后接著執(zhí)行:dbms_output.put_line('成功插入'||:new.empId);么?是的話,如何拼接? 謝謝大家?guī)椭治龉?/p>
謝謝老師的精彩講解。 有個(gè)問題:就是在執(zhí)行行級觸發(fā)器語句時(shí) 還希望能在sqlplus屏幕上打印相關(guān)信息時(shí) 是在then后接著執(zhí)行:dbms_output.put_line('成功插入'||:new.empId);么?是的話,如何拼接? 謝謝大家?guī)椭治龉?/p>
2017-06-19
舉報(bào)
2017-07-31
set serveroutput on
create or replace trigger xxx
before
update
on emp
for each row
begin
? ?update backups set sal=:new.sal where empno=:new.empno;
? ?dbms_output.put_line('成功備份:'||:new.empno||'的工資'||:new.sal||'元');
end;
/
update emp set sal=sal+10;
commit;
select * from emp;
select * from backups;
成功備份:7369的工資1549.88元
成功備份:7499的工資2949.95元
成功備份:7521的工資2511.49元
成功備份:7566的工資5629.44元
成功備份:7654的工資2511.49元
成功備份:7698的工資5385.86元
成功備份:7782的工資4606.37元
成功備份:7839的工資9575.59元
成功備份:7844的工資3047.4元
成功備份:7900的工資1868.42元
成功備份:7902的工資5678.15元
成功備份:7934的工資2618.66元
成功備份:8000的工資1546.88元