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: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Tue, 17 Feb 2004 08:06:00 -0800
Message-ID: <1077033916.911045@yasure>


Massimo wrote:

> 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

Post the error message.

And I'd be interested in what value you are associating with the ROWID. What do you think it is going to get you? Are you aware of the fact that a ROWID is not a fixed identifier of a row of data: They can change.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Tue Feb 17 2004 - 10:06:00 CST

Original text of this message

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