Nitesh Nitesh - 1 month ago 5
SQL Question

Select the last updated row in oracle

How can I get the last updated row or record in an oracle database?

I want to ensure that a trigger is fired to check whether the last updated row has all uppercase entries, and if not convert them to upper case.

Answer

Just write a trigger to do that:

create trigger mytable_trg
before insert or update on mytable
for each row
begin
   :new.col1 := upper(:new.col1);
   :new.col2 := upper(:new.col2);
end;

The trigger fires for each row inserted or updated, so there is no need to "find" the row.

Comments