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

Home -> Community -> Usenet -> c.d.o.server -> Re: How To Declare Host Variables in VB

Re: How To Declare Host Variables in VB

From: Martin Haltmayer <Martin.Haltmayer_at_d2mail.de>
Date: Tue, 18 Dec 2001 15:56:01 +0100
Message-ID: <3C1F5901.76DBA96B@d2mail.de>


Hi Aman,

you may declare your sequence as

create sequence abc order;

Then Oracle would guarantee that the numbers are generated in their order of request.

Further, Oracle guarantees that the numbers are unique unless you cycle them.

Regards,

Martin

Aman wrote:
>
> Hi Jim,
> We are developing this product for a multi user environment.
> Now imagine a case where two or three people enter in the module and
> try to add a record simultaneously. How will I assign them a unique
> ID? If I don't lock a table imagine a case where the record failed to
> insert.
>
> In my case where I had locked the table and generated my own unique ID
> rolling back and maintaining the sequence of IDs is easy but if it was
> assigned a oracle sequence object while creation of the table, then
> firstly I would not get unique ID's and my system would fail for an
> insert and secondly the ID's generated need not be in a proper
> sequence.
>
> "Jim Kennedy" <kennedy-family_at_home.com> wrote in message news:<DGKM7.83963$XJ4.45873705_at_news1.sttln1.wa.home.com>...
> > Why do you lock the table for insert? I can't think of a good reason for
> > doing this.
> > Jim
> > "Aman" <gulatiaman_at_yahoo.com> wrote in message
> > news:8b8e8b44.0111262308.e8c7ffe_at_posting.google.com...
> > > We are declaring an Anonymous block of PL/SQL to insert new data into
> > > the database. In the anonymous block of PL/SQL we need to lock the
> > > table for insert initially, we are also generating the next valid ID
> > > that needs to be associated with the new record. And after the insert
> > > is a success we commit the changes and come out of the PL/SQL. And
> > > Incase the insertion fails we rollback the transaction and exit the
> > > block.
> > > As mentioned earlier ID is being generated manually inside the block.
> > > Now in order to carry on we need to find the ID for which the record
> > > was inserted.
> > > If somehow we could declare the host variable in VB it would make my
> > > life a lot simpler.
Received on Tue Dec 18 2001 - 08:56:01 CST

Original text of this message

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