Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: returning values from INSERT
Thomas Ruschival <t.ruschival_at_vivid-md.de> wrote in message news:<20020424215158.40533206.t.ruschival_at_vivid-md.de>...
> Hi,
>
> in SQL*PLUS I can declare bindvariables and use the in Statements like
> "INSERT INTO tbl_test(col1,col2) VALUES (seq_test.nextval, 'Hello World')
> RETURNING col1 INTO :bindvariable".
> Is it somehow possible to do this with JDBC as well?
> I am currently doing a workaround, that is not satisfying (at least for
> me): I do 2 Statements, first I get the nextval fo the sequence second I
> do the insert with the result of the first. That is not the way I want to
> write programs..... well I am new to JDBC/Oracle. my Configuration:
> Oracle 9i EE, Oracle JDBC Thin driver, Sun JDK 1.3.1 SE
>
> Do you have any hints for me?
>
> Thanks
> Thomas
Maybe you can use SEQ_TEST.CURRVAL just after inserting the value in the same statement, it gets the current value of the sequence.
Stef Received on Thu Apr 25 2002 - 04:15:47 CDT