trigger update delete

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

trigger update delete

Sim Zacks
I am trying to write a trigger function that will do something when either a
row had been deleted or a field has been updated to null.

The problem I am having is determining in the function if this is a delete
or not. I would like to say:
if this is delete trigger or new.field1 is null then
    ...
end if

new.field1 dies when it is a delete trigger, as it is supposed to. But I
need the function to know the difference.

Any thoughts?



---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Reply | Threaded
Open this post in threaded view
|

Re: trigger update delete - found it

Sim Zacks
I found the TG_OP variable which tels me which operation is currently being
done.

"Sim Zacks" <[hidden email]> wrote in message
news:da83sd$1i7g$[hidden email]...
> I am trying to write a trigger function that will do something when either
a

> row had been deleted or a field has been updated to null.
>
> The problem I am having is determining in the function if this is a delete
> or not. I would like to say:
> if this is delete trigger or new.field1 is null then
>     ...
> end if
>
> new.field1 dies when it is a delete trigger, as it is supposed to. But I
> need the function to know the difference.
>
> Any thoughts?
>
>



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [hidden email])