oracle执行 insert语句后能返回插入的id值吗??谢谢
解决方案 »
- ORA-01194: 文件1需要更多的恢复来保持一致性ORA-01110: 数据文件 1: 'D:\ORACLE\ORADATA\DB\SYSTEM01.
- oracle convert转utf8的bug问题
- 如果使用RMAN备份在其他机器上进行数据库恢复(两台机器的目录不一致)?
- ORACLE 10G SQLPLUS不输入主机字符串能连上,输入了就连不上了,请问什么原因?
- string sql = "select * from '油井参数区L7-3366'"; 这样为什么不行???
- 请问应该如何根据下面的ora文件做一个BCB/Delphi用的ADO连接?
- 一个视图,如何捕获它的变化?
- 如何在oracle中的sql plus中操作其它数据库?
- oracle是否有超级用户密码?
- 作业调度失败,请问为何?
- Oracle时间相减
- 设置涉密级别的表,在线等
v_id t.id%type;
begin
insert into t(id) values(seq.nextval) returning id into v_id;
end;
/
which variable to hold on return value if you don't want to use procedure?
try {
con = OConnection.getConn();
DatabaseMetaData dmd = con.getMetaData(); System.out.println("database product name: "
+ dmd.getDatabaseProductName());
System.out.println("database product version: "
+ dmd.getDatabaseProductVersion());
System.out.println("supports generate keys? "
+ dmd.supportsGetGeneratedKeys()); String sql = "INSERT INTO test11(ID,sdate) " + "VALUES (t_seq.nextval, ?)"; ps = con.prepareStatement(sql, new String[] { "ID" }); ps.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
ps.executeUpdate();
Statement st = null;
st = con.createStatement();
st.executeQuery(sql);
if (dmd.supportsGetGeneratedKeys()) {
rs = ps.getGeneratedKeys();
while (rs.next()) {
System.out.println("ID: " + rs.getInt(1));
}
} } catch (SQLException e) {
SQL> print i; I
----------SQL> insert into t1(id) values(5) returning id into :i;1 row created.SQL> print i; I
----------
5