有誰知道如何獲取通過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