65 lines
1.9 KiB
MySQL
65 lines
1.9 KiB
MySQL
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 'UPDATE usuario_ubicacion SET activo=0, usuariomodif_id=1, fecmodif=sysdate WHERE ROWID IN ( SELECT rid FROM ( SELECT ROWID rid, ROW_NUMBER() OVER(PARTITION BY usuario_id, activo ORDER BY ROWID ) rn FROM usuario_ubicacion where activo=1 ) WHERE rn <> 1 )';
|
|
exception
|
|
when dup_val_on_index then null;
|
|
when except_02291 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 usuario_ubicacion ADD PADRAO NUMBER(1,0)';
|
|
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 'UPDATE usuario_ubicacion set padrao=1 WHERE activo=1';
|
|
exception
|
|
when dup_val_on_index then null;
|
|
when except_02291 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 'insert into constante (constante_id,nombconstante,descconstante,valorconstante,indmantenimientousuario,activo,fecmodif,usuario_id)
|
|
values (constante_seq.nextval,''IND_MULTI_PUNTOVENTA_CRIADO'',''INDICA SE O CODIGO O CODIGO, JÁ POSSUI O MULTI PTV'',''true'',0,1,sysdate,1)';
|
|
exception
|
|
when dup_val_on_index then null;
|
|
when except_02291 then null;
|
|
end;
|
|
/
|
|
|
|
|
|
|
|
|