bug#15267
dev:thiago qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@96823 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d3d819b347
commit
0963e2e44f
|
@ -0,0 +1,7 @@
|
|||
declare
|
||||
column_exists exception;
|
||||
pragma exception_init (column_exists , -01430);
|
||||
begin
|
||||
execute immediate 'ALTER TABLE BPE_CTRL_DISPONIBILIDADE ADD (TIPO_VENDA VARCHAR(20))';
|
||||
exception when column_exists then null;
|
||||
end;
|
|
@ -0,0 +1,39 @@
|
|||
declare
|
||||
object_exists exception;
|
||||
pragma exception_init (object_exists , -00001);
|
||||
begin
|
||||
execute immediate 'merge into bpe_ctrl_disponibilidade cd1
|
||||
using
|
||||
(
|
||||
select b.tipoventa_id, cd.bpectrldisp_id, cd.tipo_venda
|
||||
from bpe_ctrl_disponibilidade cd
|
||||
join bpe bpe on bpe.bpe_id = cd.bpe_rejeitado_id
|
||||
left join boleto b on b.boleto_id = bpe.boleto_id
|
||||
where cd.activo = 1
|
||||
and b.tipoventa_id = 99
|
||||
and cd.tipo_venda is null
|
||||
) t on (cd1.bpectrldisp_id = t.bpectrldisp_id)
|
||||
WHEN MATCHED THEN UPDATE SET cd1.tipo_venda = ''EMBARCADA''
|
||||
';
|
||||
exception when object_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
object_exists exception;
|
||||
pragma exception_init (object_exists , -00001);
|
||||
begin
|
||||
execute immediate 'merge into bpe_ctrl_disponibilidade cd1
|
||||
using
|
||||
(
|
||||
select b.tipoventa_id, cd.bpectrldisp_id, cd.tipo_venda
|
||||
from bpe_ctrl_disponibilidade cd
|
||||
join bpe bpe on bpe.bpe_id = cd.bpe_rejeitado_id
|
||||
left join boleto b on b.boleto_id = bpe.boleto_id
|
||||
where cd.activo = 1
|
||||
and b.tipoventa_id <> 99
|
||||
and cd.tipo_venda is null
|
||||
) t on (cd1.bpectrldisp_id = t.bpectrldisp_id)
|
||||
WHEN MATCHED THEN UPDATE SET cd1.tipo_venda = ''TOTALBUS''
|
||||
';
|
||||
exception when object_exists then null;
|
||||
end;
|
|
@ -0,0 +1,6 @@
|
|||
DO $$
|
||||
BEGIN
|
||||
ALTER TABLE BPE_CTRL_DISPONIBILIDADE ADD (TIPO_VENDA VARCHAR(20));
|
||||
EXCEPTION WHEN duplicate_column THEN NULL;
|
||||
END
|
||||
$$;
|
Loading…
Reference in New Issue