Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> force inclusion of certain fields in update (trigger?)

force inclusion of certain fields in update (trigger?)

From: Alexander Zimmer <zimmer_at_hollomey.com>
Date: Thu, 21 Feb 2002 11:02:28 +0100
Message-ID: <MPG.16dee3eacec89a93989680@news.cis.dfn.de>


Problem:

A table TABLE1 has 3 columnns:
  id number,
  text varchar(20),
  username varchar(10)

Each time a row is updated, I want to force the user to include his username in the update.

The following update would be illegal and should be rejected:

  update TABLE1
  set text='new text'
  where id=1;

Whereas the following update would be legal:

  update TABLE1
  set text='new text', username='alex'
  where id=1;

More precisely, table1 is a config table which is only updated manually and never by a program. So when a user updates this config table, I want to make sure that the field "username" contains the username of this updating user. Surely, I cannot force the user to include his *correct* name, he could be faking, but the point is just that I want to FORCE him to include the field username at all!

How can this be achieved?

Idea: in a trigger on the table TABLE1 a la:

  if inserting then
    if :new.username is null then

So, how can the ?????? be solved?

Any ideas?

TIA,
Alex Received on Thu Feb 21 2002 - 04:02:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US