在将某些行插入表格后,如何获得"on commit"触发器的等价物?
在向表中插入多行后,我想向外部进程发送一条消息,表明有行可以处理.使用语句级触发器会导致每个插入一条消息,我只想发送一条消息,说"有待处理的行".
创造一份工作.在提交发生之前,它实际上不会被提交.(注意:DBMS_SCHEDULER通常比DBMS_JOB好,但在这种情况下,您需要使用旧的DBMS_JOB包.)
declare
jobnumber number;
begin
dbms_job.submit(job => jobnumber, what => 'insert into test values(''there are rows to process'');');
--do some work here...
commit;
end;
/
Run Code Online (Sandbox Code Playgroud)