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: Return ROWID in Java

Re: Return ROWID in Java

From: ReplyToGroups <sorry_at_NoAddress.com>
Date: Tue, 17 Feb 2004 15:20:09 -0500
Message-ID: <c0tt1q$rrr2@eccws12.dearborn.ford.com>


use sequence_name.nextval

If u want the primarkey value to be returned to the client

"Jeff Smith" <jsmit234 at ford dot com> wrote in message news:c0tg7v$rrq5_at_eccws12.dearborn.ford.com...
> Be careful here. ROWIDs are really only stable enough to use on a
> transaction basis, and some would argue that. Oracle can change them right
> out from under you. This did not use to be the case in older versions, but
> it is now.
>
> We have been forced to do similar things in the past mainly because of
> reciulous compound keys, but you want to stay away from this approach.
>
> I would look into returning the primary key value of the row if at all
> possible.
>
> "Massimo" <massimo.visman_at_tin.it> wrote in message
> news:jopYb.246730$VW.9927307_at_news3.tin.it...
> > Hi all, I'm new to Oracle systems and I need a little help for build a
> Java
> > application using this db. I have to insert a new record and to retrieve
> the
> > current pk automatically created by a sequence associated to the field -
> > say: AccountID.
> >
> > I think I can try to do it by executing a PL/SQL block of code, and then
> > call it using a Java callable statement to retrieve the value, stored in
a
> > PL/SQL variable ... something like this:
> >
> > declare
> > rid ROWID;
> > begin
> > insert into Accounts (AccountFirstName, AccountLastName, AccountLogin,
> > AccountPassword, AccountEmail) VALUES ('val',val','val','val','val')
> return
> > ROWID into rid;
> > end;
> >
> > This piece of code doesn't work ... anyone can post me a suggestion or
an
> > example?
> >
> > Thanks a lot! Massimo
> >
> >
>
>
Received on Tue Feb 17 2004 - 14:20:09 CST

Original text of this message

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