create or replace trigger add_trips
AFTER UPDATE OR INSERT OR DELETE ON TRIP
DECLARE
trip_num DRIVER.TRIPS%TYPE;
BEGIN
UPDATE DRIVER SET trips = (SELECT COUNT(L#) AS NUMOFTRIPS FROM TRIP WHERE
DRIVER.L# = TRIP.L#)
WHERE EXISTS (SELECT TRIP.L# FROM TRIP WHERE TRIP.L# = DRIVER.L#);
END;
有没有一种方法可以在触发器运行后显示更新的行?
答案 0 :(得分:0)
如果您只是在寻找更新/插入的行数,则可以使用以下命令通过dbms-output显示这些行:
dbms_output.put_line(sql%rowcount || ' rows updated/inserted.');