how to trap ORA-00942: table or view does not exist?
566653Mar 13 2007 — edited Mar 13 2007I 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;
/