Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Function to check if value changed? (in trigger)

David BalažicJun 15 2011 — edited Jun 15 2011
Hi!

I'm sure this is FAQ but I couldn't find an answers.

I am looking for a way to compare two values for equality , but also accounting for NULL as being same.

I need this for a trigger, where I would check if the new value is the same as old (or both null) to avoid some costly operations in such case.

Of course I cold write :OLD.column = :NEW.column or :OLD.column is null and :NEW.column is null,
but there must be a shorter way.

Or must I just write an own function? Polymorphic? (NUMBERs , VARCHAR2s, DATEs)

Regards,
David
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 13 2011
Added on Jun 15 2011
8 comments
709 views