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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle form builder automatic increment while inserting new row

Re: Oracle form builder automatic increment while inserting new row

From: Frank van Bortel <frank.van.bortel_at_gmail.com>
Date: 31 May 2006 04:24:59 -0700
Message-ID: <1149074699.777103.85050@u72g2000cwu.googlegroups.com>

ukiEMAIL_at_gmail.com schreef:

> Hi I create block of data using table mybase (it's structure is id
> NUMBER PK, name VARCHAR2(20)).
> I want to achieve effect that if I lanch the form and I will press
> insert new record the new record will have in Id cell the highest next
> possible value (typed automatically by the program).
>
> I make WHEN-CREATE-TRIGGER with structure:
> Select max(id)+1 into :MYBASE.ID from MYBASE;
>
> which works only for one insertion. When I press insert new record one
> more time it will still have the old max(id)+1 value. I think it's
> because the commit isn't executed when pressing insert new record.
>
> So my problem is how to force system to commit change after each
> insertion or how to achieve the same result in other way.

this is a prime example of how *not* to use sequences: 1) It does not scale
2) Imagine what happens if two users start to insert...

Solution:
Look up table triggers and sequences in the documentation on http://tahiti.oralce.com Received on Wed May 31 2006 - 06:24:59 CDT

Original text of this message

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