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

Home -> Community -> Usenet -> c.d.o.server -> Re: Triggers to update same column upon insert

Re: Triggers to update same column upon insert

From: Sybrand Bakker <gooiditweg_at_nospam.demon.nl>
Date: Thu, 17 Apr 2003 22:24:52 +0200
Message-ID: <pa3u9vcmlbul4rq8gcku05ijpiiic6qp1n@4ax.com>


On 17 Apr 2003 12:47:39 -0700, Sanjay Kumar <skumar_at_nospam.com> wrote:

>I am new to Oracle.
>
>Ver 8.1.7
>
>Is it possible to declare a trigger to update the same
>column which is being inserted upon.
>
>For e.g.,
>
>insert into table_a(field_a) values(1);
>
>and then declare a trigger on table_a which will update the value
>of field_a to field_a + 100. In effect all values of field_a gets
>incremented by 100 automatically after every insert.

Sure it is possible, a simple assignement :new.col := :new.col + 100. But why do it in this way which will end you in hell with a lousy application?

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Thu Apr 17 2003 - 15:24:52 CDT

Original text of this message

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