Re: Required field for updates

From: Stephen_CA <stephen.bell_at_sympatico.ca>
Date: 25 Jul 2003 08:50:37 -0700
Message-ID: <5aeee507.0307250750.78429f22_at_posting.google.com>


Walt <walt_at_boatnerd.com.invalid> wrote in message news:<3F1FF76B.43264144_at_boatnerd.com.invalid>...
> It's easy to make a field required for inserts, just set it to not null
> and don't give it a default.
>
> But how does one make a field required for updates? For instance, we
> have a table with a field that keeps track of which application last
> updated the table
>
> MYTABLE
> ------
> ID PK
> APPLICATION_ID
> MORE_STUFF
>
> I want to write a PL/SQL trigger that requires the application to
> specify the appilication_id, and throw an error if the application fails
> to provide a value. I.e. this SQL command should fail:
>
> "UPDATE MYTABLE set MORE_STUFF = 'foo' WHERE ID = 123;"
>
> IOW, how does one determine the update list in a PL/SQL trigger? I can
> check to see if the value changed, but that won't do it.

Hi Walt,

Unless I've completely missed the intent of your post, just include this type of logic in a BEFORE UPDATE trigger:

IF :NEW.APPLICATION_ID IS NULL THEN.... Steve Received on Fri Jul 25 2003 - 17:50:37 CEST

Original text of this message