PL/SQL Fehlerhandling eigene Fehlercodes etc.
Ein Beispiel für eigenes Fehlerhandling:
DECLARE
obj_missed EXCEPTION;
PRAGMA EXCEPTION_INIT (obj_missed, -942);
BEGIN
EXECUTE IMMEDIATE('DROP TABLE mytst');
EXCEPTION
WHEN obj_missed THEN NULL;
WHEN OTHERS THEN RAISE;
END;
/
Eine weitere Variante:
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE mytst';
EXCEPTION
WHEN OTHERS
THEN
IF SQLCODE = -942
THEN NULL;
ELSE RAISE;
END IF;
END;
/
DECLARE
obj_missed EXCEPTION;
PRAGMA EXCEPTION_INIT (obj_missed, -942);
BEGIN
EXECUTE IMMEDIATE('DROP TABLE mytst');
EXCEPTION
WHEN obj_missed THEN NULL;
WHEN OTHERS THEN RAISE;
END;
/
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE mytst';
EXCEPTION
WHEN OTHERS
THEN
IF SQLCODE = -942
THEN NULL;
ELSE RAISE;
END IF;
END;
/
Kommentare
Kommentar veröffentlichen