fixes bug#18164

dev:
qua:

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@100012 d1611594-4594-4d17-8e1d-87c2c4800839
master
thiago.clemente 2020-02-03 21:18:47 +00:00
parent ff5508b698
commit 5c429414f4
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
DECLARE
itemExists NUMBER;
BEGIN
itemExists := 0;
SELECT COUNT(CONSTRAINT_NAME) INTO itemExists
FROM ALL_CONSTRAINTS
WHERE UPPER(CONSTRAINT_NAME) = UPPER('UNIQUE_CODANTT');
IF itemExists > 0 THEN
BEGIN
EXECUTE IMMEDIATE 'ALTER TABLE PARADA DROP CONSTRAINT UNIQUE_CODANTT';
EXECUTE IMMEDIATE 'DROP INDEX UNIQUE_CODANTT;';
exception when others THEN null;
END;
END IF;
END;
/
DECLARE
object_exists exception;
except_01408 exception;
pragma exception_init (object_exists , -00955);
pragma exception_init (except_01408 , -01408);
BEGIN
execute IMMEDIATE 'CREATE UNIQUE INDEX UNIQUE_CODANTT ON PARADA (CASE WHEN ACTIVO = 1 THEN CODANTT ELSE NULL END)';
exception
when object_exists THEN null;
when except_01408 THEN null;
END;