Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to trap ORA-00942: table or view does not exist?

566653Mar 13 2007 — edited Mar 13 2007
I made this statement to trap either the ORA-00942 and ORA-01400..

the ORA-01400's trap works fine, but nor the ORA-00942's trap (i intently type wrong table name in the insert statement to test the trap), it creates another ORA-06550 before ORA-00942 and i couldnt trap the ORA-06550 also..

Please give me any clue..

SET SERVEROUTPUT ON;
DROP TABLE tes_error_00942;
CREATE TABLE tes_error_00942 (
field1 VARCHAR2(100) NOT NULL,
field2 VARCHAR2(100));

DECLARE
tidak_ada EXCEPTION;
jangan_null EXCEPTION;
PRAGMA EXCEPTION_INIT (tidak_ada, -00942);
PRAGMA EXCEPTION_INIT (jangan_null, -01400);
BEGIN
INSERT INTO tes_error_009421 (field1,field2) VALUES (NULL, 'isi2');
EXCEPTION
WHEN tidak_ada THEN
DBMS_OUTPUT.PUT_LINE('Tidak Ada Tabelnya');
WHEN jangan_null THEN
DBMS_OUTPUT.PUT_LINE('Tidak Boleh Isi Null');
END;
/
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 10 2007
Added on Mar 13 2007
4 comments
975 views