Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger for INSERT
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
![]() |
![]() |