75 lines
2.0 KiB
SQL
75 lines
2.0 KiB
SQL
declare
|
|
object_exists exception;
|
|
pragma exception_init (object_exists , -00955);
|
|
begin
|
|
execute immediate
|
|
'CREATE TABLE BPE
|
|
(
|
|
BPE_ID NUMBER(7,0),
|
|
TIPOAMB NUMBER(1,0),
|
|
UF VARCHAR2(2 BYTE),
|
|
VERSAOAPLICACAO VARCHAR2(20 BYTE),
|
|
CODSTAT VARCHAR2(3 BYTE),
|
|
MOTIVO VARCHAR2(255 BYTE),
|
|
RETORNO_ID VARCHAR2(20 BYTE),
|
|
CHBPE VARCHAR2(44 BYTE),
|
|
DHRECBTO VARCHAR2(25 BYTE),
|
|
NPROT VARCHAR2(15 BYTE),
|
|
INDCONTINGENCIA NUMBER(1,0),
|
|
ACTIVO NUMBER(1,0),
|
|
FECMODIF DATE,
|
|
USUARIO_ID NUMBER(7,0)
|
|
)';
|
|
|
|
exception when object_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
object_exists exception;
|
|
pragma exception_init (object_exists , -00955);
|
|
begin
|
|
execute immediate 'CREATE SEQUENCE "BPE_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1';
|
|
|
|
exception when object_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
column_exists exception;
|
|
pragma exception_init (column_exists , -01430);
|
|
begin
|
|
execute immediate 'ALTER TABLE BPE ADD (BOLETO_ID NUMBER(15))';
|
|
exception when column_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
column_exists exception;
|
|
pragma exception_init (column_exists , -01430);
|
|
begin
|
|
execute immediate 'ALTER TABLE BPE ADD (VERSAO VARCHAR2(8))';
|
|
exception when column_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
column_exists exception;
|
|
pragma exception_init (column_exists , -01430);
|
|
begin
|
|
execute immediate 'ALTER TABLE BPE ADD (CNPJ VARCHAR2(14))';
|
|
exception when column_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
column_exists exception;
|
|
pragma exception_init (column_exists , -01430);
|
|
begin
|
|
execute immediate 'ALTER TABLE BPE ADD (QRCODE VARCHAR2(255))';
|
|
exception when column_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
column_exists exception;
|
|
pragma exception_init (column_exists , -01430);
|
|
begin
|
|
execute immediate 'ALTER TABLE BPE ADD (CBP VARCHAR2(8))';
|
|
exception when column_exists then null;
|
|
end;
|