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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -