Nitesh Nitesh - 11 months ago 59
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 Source

Just write a trigger to do that:

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

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