Re: Creating primary key values with trigger

From: Leo Mannhart <mannhart_at_zuv.unizh.ch>
Date: Fri, 9 Sep 1994 08:04:41 GMT
Message-ID: <mannhart-0909940904410001_at_zuvmaclm.unizh.ch>


In article <34m2a3$evv_at_crcnis1.unl.edu>, nolan_at_helios.unl.edu wrote:

> ppf_at_fct.unl.pt (Pedro Pimentel) writes:
>
> > This way I have to use a default value (usually 0) in the ID field in
> >the form application (I'm using MS Access, much better than SQL*Forms :) )
> >so that oracle passes by the not null check and then runs the trigger.
 

> > Any other ideia, comments ?
>
> Use Forms. Then you can have the primary key generated in a PRE-INSERT forms
> trigger, and even have it propogated to detail records you may be creating.
>

You're right, but this lacks the creation of primary keys for one who is using SQL*Plus or the SQL*Loader (at the same time). If you use PRE-INSERT triggers in SQL*Forms then you get primray keys in forms but not in any other product. On the other hand, if you use database triggers, you can insert records via plus or the loader. But in forms you will see this funny "record changed by an other user" message. So disable the forms trigger, but then forms is missing the primary key during insert and will fail.
Anyone who as a solution or are we really back by the Flintstones family where we lock a table in exclusive mode, enable the database trigger, do our inserts, disable the database trigger and release the table lock so others can do inser in forms applications?

-- 
Leo Mannhart
Planning Office
University of Zurich           phone: ++41 1 257 23 34
Kuenstlergasse 15                fax: ++41 1 257 22 12
CH-8001 Zurich, Switzerland    eMail: mannhart_at_zuv.unizh.ch
Received on Fri Sep 09 1994 - 10:04:41 CEST

Original text of this message