oracleåå¨è¿ç¨å¤æä¸æ¡sqlè¯å¥æ¯å¦æåçæ¹æ³æ¯å¢å exceptionå¤çï¼å¦æ没ææåºexceptionï¼é£å°±è¯ææ£å¸¸æ§è¡äºã
å¨Oracleä¸ï¼å¼å¸¸å为以ä¸ä¸¤ç±»ï¼
Oracleé¢å®ä¹å¼å¸¸
ç¨æ·èªå®ä¹å¼å¸¸
å¨Oracleä¸é¢å®ä¹çå¼å¸¸å¦ä¸è¡¨æ示ï¼
å¨Oracleä¸æ以ä¸ä¸ç§æ¹å¼è§¦åå¼å¸¸ï¼
ç±Oracleèªå¨è§¦åå¼å¸¸
使ç¨RAISEè¯å¥æ工触å
è°ç¨åå¨è¿ç¨RAISE_APPLICATION_ERRORæ工触å
代ç å°æ¼ç¤ºOracleèªå¨è§¦åå¼å¸¸ï¼
-- Created on 2015-7-14 by JellyThink
declare
iA NUMBER(2) := 10;
begin
iA := iA / 0; -- Oracleèªå¨è§¦åå¼å¸¸
dbms_output.put_line(iA);
exception
when ZERO_DIVIDE then
dbms_output.put_line('Error Code:' || SQLCODE || ' ' || SQLERRM);
when others then
dbms_output.put_line('Others Exception');
end;