fixes bug#AL-2649

master
Gleison da Cruz 2023-05-30 17:15:49 -03:00
parent cb1488311c
commit bc7418c9ff
2 changed files with 42 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId> <groupId>br.com.rjconsultores</groupId>
<artifactId>Flyway</artifactId> <artifactId>Flyway</artifactId>
<version>1.3.6</version> <version>1.3.7</version>
<distributionManagement> <distributionManagement>
<repository> <repository>

View File

@ -0,0 +1,41 @@
declare
object_exists exception;
except_00957 exception;
pragma exception_init (object_exists , -01430);
pragma exception_init (except_00957 , -00957);
begin
execute immediate 'ALTER TABLE COTACAO RENAME COLUMN VALOR TO VALOR_ANTIGO';
exception
when object_exists then null;
when except_00957 then null;
end;
/
declare
object_exists exception;
except_01451 exception;
except_01442 exception;
pragma exception_init (object_exists , -01430);
pragma exception_init (except_01451 , -01451);
pragma exception_init (except_01442 , -01442);
begin
execute immediate 'ALTER TABLE COTACAO ADD (VALOR NUMBER(10,7) )';
exception
when object_exists then null;
when except_01451 then null;
when except_01442 then null;
end;
/
declare
dup_val_on_index exception;
except_02291 exception;
pragma exception_init (dup_val_on_index , -00001);
pragma exception_init (except_02291 , -02291);
begin
execute immediate 'BEGIN FOR COTACAO_ATUAL IN (SELECT VALOR_ANTIGO, COTACAO_ID FROM COTACAO) LOOP UPDATE COTACAO SET VALOR = COTACAO_ATUAL.VALOR_ANTIGO WHERE COTACAO_ID = COTACAO_ATUAL.COTACAO_ID; END LOOP; COMMIT; END;';
exception
when dup_val_on_index then null;
when except_02291 then null;
end;