日期:2014-05-16 浏览次数:20515 次
PreparedStatement sta = conn.prepareStatement("INSERT INTO LOGGING VALUES (TESTSEQ.NEXTVAL,SYSDATE)returning id into ? "); sta.execute(); ResultSet rset = sta.getResultSet(); while(rset.next()) { int id = rset.getInt(1); }
PreparedStatement sta = conn.prepareStatement("INSERT INTO TESTTABLE VALUES (TESTSEQ.NEXTVAL,'aaaa')",Statement.RETURN_GENERATED_KEYS); sta.execute(); System.out.println(sta.getGeneratedKeys()); ResultSet rest = sta.getGeneratedKeys(); rest.next(); //oracle rowid System.out.println(rest.getString(1));