首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

oracle 错误获取有关问题

2012-02-05 
oracle 异常获取问题sql语句:beginsavepoint psmerge into 1merge into 2merge into 3merge into 4..

oracle 异常获取问题
sql语句:
 begin
 savepoint ps;
  merge into 1;
  merge into 2;
  merge into 3;
  merge into 4;
....
  commit;
exception
  when others then
  rollback to ps;
end;
后台:
  try {
  String strSql =“sql”;
  con = DataSource.getDataSource();
  ps = con.prepareStatement(strSql);
  int result = ps.executeUpdate();

  }
  catch (Exception e) {
  throw e;
  }


希望在页面显示捕获的异常,求解。

[解决办法]
在sql里这样写

exception
when others then
begin
rollback to ps;
raise;
end;
end;

里面的RAISE也可以自己定义错误信息,不过一般用ORACLE的错误信息就好了

热点排行