Re: Help for an Oracle Newbie
Date: Sat, 23 Aug 2008 21:11:38 +0200
"DA Morgan" <damorgan_at_psoug.org> schreef in bericht
> Shakespeare wrote:
>>> CREATE OR REPLACE TRIGGER bu_t
>>> BEFORE UPDATE
>>> ON t
>>> FOR EACH ROW
>>> IF (:NEW.lastmodified IS NULL) OR (:NEW.lastmodified =
>>> :OLD.lastmodified) THEN
>> Hey, you didn't suggest this line!
> Did I need to? <g>
To ask is to know...
>>> 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
>> b) is incorrect, because lastmodified should be updated when not null
> If it is NOT NULL then it will not be equal to the previous value.
O yes it can be, if a user selects a record and updates some columns except lastupdated. (E.g. using Oracle Forms: query a record, update and commit.) In that case lastmodified will not be updated, where the record was changed!
> 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
(to quote Vladimir M. Zakharychev quoting Voltaire "Better is the enemy of good.") Received on Sat Aug 23 2008 - 14:11:38 CDT