Prevent error when dropping not existing sequences, creating existing users

前端 未结 5 897
北荒
北荒 2020-12-20 16:17

I have a bunch of sql scripts that create / drop sequences, users and other objects. I\'m running these scripts through liquibase, but they fail because oracle complains whe

5条回答
  •  独厮守ぢ
    2020-12-20 16:30

    Write a function do_ddl similar to this and catch all exceptions you want to catch:

    DECLARE
       allready_null EXCEPTION;
       PRAGMA EXCEPTION_INIT(allready_null, -1451);
    BEGIN
       execute immediate 'ALTER TABLE TAB MODIFY(COL  NULL)';
    EXCEPTION
       WHEN allready_null THEN
          null; -- handle the error
    END;
    /
    

提交回复
热议问题