sql - get last inserted row id in ebean with sqlupdate -


if using ebean sqlupdate insert oracle in java

    transaction tx = ebean.begintransaction();     try {  transaction tx = ebean.begintransaction(); try {      string sqlstring = "insert customers values (1001,'nichols', 'alexandra', '17 maple drive', "+ "'nashua', 'nh','03062', sdo_geometry(2001, 8307, sdo_point_type (-71.48923,42.72347,null), null, null))";     sqlupdate query = ebean.createsqlupdate(sqlstring);     query.execute();     string sqlquery =             "select @@identity 'identity'";     sqlquery query2 = ebean.createsqlquery(sqlquery);      list<sqlrow> list = query2.findlist();     system.out.println(list.get(0)); } {   tx.commit(); } 

it gives error

[persistenceexception: query threw sqlexception:ora-00936: missing expression   query was: select @@identity 'identity'  ] 

how id of last inserted row?

after insert, select into, or bulk copy statement completed, @@identity contains last identity value generated statement.

but in sql think should create usp , can return last inserted record id outparm usp

   string sqlstring = "insert customers values (1001,'nichols', 'alexandra', '17 maple drive', "+ "'nashua', 'nh','03062', sdo_geometry(2001, 8307, sdo_point_type (-71.48923,42.72347,null), null, null))";    sqlupdate query = ebean.createsqlupdate(sqlstring);    query.execute();    select @@identity 'identity';   

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -