Re: I can't find the right trigger

From: <maarten.scharroo_at_wkap.nl>
Date: Wed, 3 Jan 2001 12:08:46 +0100
Message-ID: <92v1c3$2f5$1_at_nereid.worldonline.nl>


Jerome,

You can both the PRE_INSERT solution and use a database trigger. Look at how Oracle creates the TAPI - triggers in Oracle Designer to see how it works.

Maarten

"Jérôme PERRET" <jperret_at_freesurf.fr> wrote in message

news:92uucc$bou$1_at_wanadoo.fr...

> Joost Bataille <bataille_at_ic.uva.nl> a écrit dans le message :
> 92uqjh$447$1_at_mail.ic.uva.nl...
>
> > I think you can use a post-insert trigger. It fires after the insert in
> > table A so you can query table A for the value that has just been
 inserted
> > in the code column. There's your value. Then you write an insert
 statement
> > for your insert into table B.
> >
>
> In a POST-INSERT trigger, forms doesn't know the value of my column (even
 if
> it has allready been filled by the table trigger). So I need to requery my
> table to have my value but how can I query a table in order to obtain the
> value of the primary key (because my sequencial column is my PK) ??
> I can't because all others columns are *NOT* unique.
> I wrote my POST-INSERT trigger using "select max(code) from ..." and it
> works but it's not perfect because we cannot know what will happen if 2
> users insert in the same time !
>
> > Another possibility:
> > Drop or disable the trigger on the table.
> > If you have a screen item 'code' then in the pre-insert trigger you
 write:
> > select seq_A.nextval into l_code from dual;
> > :code := l_code;
> > Then you have your sequence value in l_code.
> >
>
> This possibility bring the folowing problem : if someone insert into my
> table with something else than forms (MS Excel, ODBC, SQL*PLUS, ...) he
> won't have the sequence on the column (because I drop or diable the table
> trigger) !
>
> > I think I'd prefer the first option.
>
> Me too, except the problem above !
>
>
>
Received on Wed Jan 03 2001 - 12:08:46 CET

Original text of this message