开发者

Oracle 10g Statement level trigger how can I access the rows that have been affected by the statement level trigger

I am writing a trigger and I need to use a statement level trigger. Now when doing so I need to somehow access the rows that have been affected by this trigger. My question is can I access something similar the Inserted and Updated tables that MSSQL uses, or does anyone have any other way in which I开发者_StackOverflow中文版 could achieve what I am trying to do?

Thanks!


You'd need multiple triggers (or a compound trigger in 11g with row-level and statement-level sections). In a row-level trigger, you would see the row that was changed and place some data (a primary key, the ROWID, or the entire row depending on your needs) in either a temporary table, a collection defined in a package, or in a collection defined in your compound trigger. In your statement-level trigger, you would iterate over the rows that your row-level trigger just identified. Personally, I'd also tend to create a before statement trigger that initialized the collection just in case there was still data in whatever structure you're maintaining when the statement is first executed).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜