我正在学习PL/SQL这些日子,目前正在使用人权专册的程序与例外。
这里是我的简单程序。
create or replace
PROCEDURE DEL_JOB
(p_jobid jobs.job_id%TYPE)
AS
sqle NUMBER;
sqlm VARCHAR2(300);
BEGIN
DELETE FROM JOBS
WHERE JOB_ID = UPPER(p_jobid);
IF SQL%NOTFOUND THEN
DBMS_OUTPUT.PUT_LINE( No such record );
END IF;
EXCEPTION
WHEN OTHERS THEN
sqle := SQLCODE;
sqlm := SQLERRM;
DBMS_OUTPUT.PUT_LINE( There is no job with this id that could be deleted );
DBMS_OUTPUT.PUT_LINE( Error Code = ||sqle|| Error message = ||sqlm);
END;
当我执行这一程序时,产出是
No such record
PL/SQL procedure successfully complete.
然而,根据Oracle PDF,它应当放弃一个例外,我应该真正获得我作为例外所传递的信息。
Same thing happened with the Update on non existing record. Please advise. Thanks