有谁知道如何获取通过JDBC创建的触发器。看来问题在于分号。任何反馈非常赞赏。当数据库上运行,而不是在使用Java代码运行通过JDBC创建触发器(oracle)
下面的SQL工作:
Connection c=null;
Statement s=null;
try {
c=dataSource.getConnection();
s=c.createStatement();
s.executeUpdate("create or replace trigger startuptrigger after insert on startuptest for each row begin insert into startuptest values(99); end");
s.close();
s=null;
c.close();
c=null;
} catch(SQLException e) {
if(s!=null) { try { s.close(); } catch(Exception f){} }
if(c!=null) { try { c.close(); } catch(Exception f){} }
throw new IOException(e.toString());
}
我已经试过s.execute(...)和s.executeUpdate(... )并没有区别。我使用的是ojdbc5.jar驱动程序。 Oracle返回错误:
ORA-04098: trigger 'POLICYUAT.STARTUPTRIGGER' is invalid and failed re-validation
+1为The Doors歌词风格:_“结尾在尽头”_ ;-) – splash 2013-01-08 09:01:02