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: Trigger for INSERT

Re: Trigger for INSERT

From: Mark G <someone_at_hot>
Date: Mon, 5 Jul 1999 13:41:26 +0100
Message-ID: <3780a593.0@145.227.194.253>


Its usually not good 'database' practise to have calculated fields in tables, they are better off being calculated when needed.

Enough of the purist thing, why don't you try creating your my_tab table without the calculated field and a view with an extra field which does your calculation? When you are doing queries which use the calculated field, use the view.

HTH M

lanzinge_at_in.tum.de wrote in message <7lq22b$gum$1_at_nnrp1.deja.com>...
>Hello *,
>
>I have a table my_tab with the following structure:
> CREATE TABLE my_tab (
> adr INTEGER CONSTRAINT pk PRIMARY KEY,
> a INTEGER,
> b INTEGER,
> c INTEGER,
> sales INTEGER);
>Now the 'adr' column is a value that may be calculated from the columns
>'a','b','c'. Is it possible to set up an BEFORE INSERT TRIGGER to
>calculate that 'adr'? I tried to do so, but as the trigger body has to
>execute an INSERT statement on 'my_tab' there always is a recursion :-(
>
>Any suggestions?
>
>Thanks
> J.Lanzinger
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Received on Mon Jul 05 1999 - 07:41:26 CDT

Original text of this message

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