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: Massimo <massimo.visman_at_tin.it>
Date: Tue, 17 Feb 2004 22:00:53 GMT
Message-ID: <pawYb.331738$_P.11410230@news4.tin.it>


I'm already there :) Finally I have found this snippet

DECLARE
  x number;
BEGIN
  INSERT INTO emp
(ename)

VALUES
('Massimo')

  RETURNING emp_id
INTO x;
  dbms_output.put_line(x);
END; It works fine 'cause in pretty more interested in returning the pk than the rowid (thanks for the tips :) ... now my problem is to obtain some response with java. I use a snippet as follows:

String query = "INSERT INTO emp (ename) VALUES ('Massimo')"; PreparedStatement pstm = myConnection.prepareStatement("declare x number; begin ? returning emp_id INTO x; dbms_output.put_line(x); END;"); pstm.setString(1, query);
resultSet = pstm.executeQuery();

but it doesn't work at all! :(

This is the error:

ORA-06550: row 1, column 32: PLS-00103: Found symbol "RETURNING" expecting one of: := . ( @ % ; indicator ORA-06550: row 1, column 58: PLS-00103: Found symbol "DBMS_OUTPUT" ORA-06550: row 1, column 81: PLS-00103: Found symbol ";" expecting one of: . ( , * % & - + / at mod rem as from into || bulk

Any suggestion?

Thanks a lot! Massimo Received on Tue Feb 17 2004 - 16:00:53 CST

Original text of this message

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