java - Get last insert id with Oracle 11g using JDBC -
i'm new using oracle i'm going off has been answered in this question. can't seem work. here's statement i'm using:
declare lastid number; begin insert "db_owner"."foo" (id, department, business) values (foo_id_seq.nextval, 'database management', 'oracle') returning id lastid; end;
when call executequery
preparedstatement have made, inserts database fine. however, cannot seem figure out how retrieve id. returned resultset object not work me. calling
if(resultset.next()) ...
yields nasty sqlexception reads:
cannot perform fetch on plsql statement: next
how lastid
? i'm doing wrong.
make function returns (instead of procedure). or, have procedure out parameter.
Comments
Post a Comment