Re: Help for an Oracle Newbie

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 22 Aug 2008 10:16:00 -0700
Message-ID: <1219425349.943220@bubbleator.drizzle.com>


Shakespeare wrote:

>> CREATE OR REPLACE TRIGGER bu_t
>> BEFORE UPDATE
>> ON t
>> FOR EACH ROW
>> BEGIN
>>   IF (:NEW.lastmodified IS NULL) OR (:NEW.lastmodified = 
>> :OLD.lastmodified) THEN

> ^
> Hey, you didn't suggest this line!

Did I need to? <g>

>
> And

>>   IF (:NEW.lastmodified IS NULL)

>
> a) is never true because of the default value so a useless condition (except
> for avoiding comparing null with null maybe)

That's why it is there but you are correct that it could probably be dropped.

and
> b) is incorrect, because lastmodified should be updated when not null too.

If it is NOT NULL then it will not be equal to the previous value.

-- 
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Fri Aug 22 2008 - 12:16:00 CDT

Original text of this message