Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Return ROWID in Java
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 - 10:41:35 CST
![]() |
![]() |