Re: Oracle form builder automatic increment while inserting new row

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Wed, 31 May 2006 07:26:20 -0400
Message-ID: <wfOdndviaIv94ODZnZ2dnUVZ_v6dnZ2d_at_comcast.com>


[Quoted] <ukiEMAIL_at_gmail.com> wrote in message news:1149068629.043337.262960_at_i40g2000cwc.googlegroups.com...
: 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.
:

don't have the time to test, but AFAIR you can use an Oracle SEQUENCE object (which is the prefered method for assigning PK values) as the default value for an item in forms (which will contribute significantly to gaps in the sequence)

you are correct the value that you are getting is identical because no commit has been issued -- but the solution is probably not to force a commit after each row.

++ mcs Received on Wed May 31 2006 - 13:26:20 CEST

Original text of this message