Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Triggers, duh! :(
Tjenare!
Deal with Null-values using 'Is Null' and 'Is Not Null'. Don't mess it up with zero-strings.
To see if a date-column that does not have a Not Null-constraint has changed, check it like this:
If :new.date_signed <> :old.date_signed or :new.date_signed Is Null And :old.date_signed Is Not Null Or :new.date_signed Is Not Null And :old.date_signed Is Null Then
This is messy so you might want to create a utility-package with a
function Date_Has_Changed that takes two dates as parameters and return
s
True Or False.
Then in your trigger it will be:
If my_utilities.Date_Has_Changed(:new.date_signed, :old.date_sign
ed) Then
-- The column has changed
Using the built-in function Updating is also an alternative, personally I
don't use it because it doesn't check if the column values really has
changed:
If Updating ("DATE_SIGNED") Then
-- The column is being updated but the value hasn't necessarilly changed
You are experiencing different behaviour in developing and testing because
Null-values occur differently in their data.
Helsningar,
Nj l
Received on Wed Jun 14 2000 - 00:00:00 CDT