专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Oracle Exception

pl sql中如何处理异常

发布时间:2010-05-20 14:01:29 文章来源:www.iduyao.cn 采编人员:星星草

pl sql中如何处理异常?

------解决方法--------------------------------------------------------
DECLARE
  v_ErrorCode NUMBER;     -- Code for the error
  v_ErrorMsg VARCHAR2(200); -- Message text for the error
  v_CurrentUser VARCHAR2(8); -- Current database user
  v_Information VARCHAR2(100); -- Information about the error
  BEGIN
  /* Code which processes some data here */
  NULL;
  EXCEPTION
  WHEN OTHERS THEN
    -- Assign values to the log variables, using built-in
    -- functions.
    v_ErrorCode := SQLCODE;
    v_ErrorMsg := SQLERRM;
    v_CurrentUser := USER;
    v_Information := 'Error encountered on ' ||
    TO_CHAR(SYSDATE) || ' by database user ' || v_CurrentUser;
    -- Insert the log message into log_table.
    INSERT INTO log_table (code, message, info)
    VALUES (v_ErrorCode, v_ErrorMsg, v_Information);
  END;
  /
 

    
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: