-1

I have a table whose name is TestTable.

Create Table TestTable(ID number,Name nvarchar2(200))

I want to write a trigger. It's a statement level trigger. My question is:

  • How to get new and old value of column in statement level trigger in oracle?

I can't use a row level trigger because I need to select row count from TestTable in trigger.

1 Answers1

1

As comments said you can't have access to :new and :old on statement level. How can you define row values if trigger that see whole statement?

Please use compound trigger (Documentation and Example). There you can write section that is statement level and another one for each row. Count you'll get in statement level and access to :old and :new you'll have on for each row section

Kacper
  • 4,798
  • 2
  • 19
  • 34
  • i know it cant get old and new value in row level trigget. okay. but how to update more row of table in trigger ? i can update only one row in row level trigger. and i cant get old and new value in statement level trigger. But how to update rows in trigger ? for example i have a TestTable. and i want to update row which is name like '%El%' .Dou you understood me ? – Elvin Habibov Nov 14 '16 at 12:50
  • @ElvinHabibov You can gather ids of rows you want to update in `for each row` and then process whole update inn `statement` section. I've attached you some links. If you need more help please describe your problem, what data do you have, what you need to do and so on – Kacper Nov 14 '16 at 13:02
  • for example. ID | NAME 1 Elvin – Elvin Habibov Nov 14 '16 at 13:09