-- Create table create table BSC_FATURAMENTO_PERDAS ( chave_perda NUMBER not null, chave_empresa NUMBER not null, categoria_pai VARCHAR2(200), categoria VARCHAR2(300), chave_produto NUMBER(15), descricao_produto VARCHAR2(300), chave_familia NUMBER(15), quantidade NUMBER(15,2), valor_diferenca NUMBER(15,2), referencia DATE, chave_categoria_pai NUMBER(10), chave_categoria NUMBER(10) ) tablespace C5DADOS pctfree 10 initrans 1 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 ); -- Add comments to the columns comment on column BSC_FATURAMENTO_PERDAS.chave_perda is 'Chave da tabela'; comment on column BSC_FATURAMENTO_PERDAS.chave_empresa is 'Chave da loja'; comment on column BSC_FATURAMENTO_PERDAS.categoria_pai is 'Descrição da categoria pai'; comment on column BSC_FATURAMENTO_PERDAS.categoria is 'Descrição da categoria'; comment on column BSC_FATURAMENTO_PERDAS.chave_produto is 'chave do produto'; comment on column BSC_FATURAMENTO_PERDAS.descricao_produto is 'Descrição do produto'; comment on column BSC_FATURAMENTO_PERDAS.chave_familia is 'Chave da família do produto'; comment on column BSC_FATURAMENTO_PERDAS.quantidade is 'Quantidade perdida em unidade'; comment on column BSC_FATURAMENTO_PERDAS.valor_diferenca is 'Valor perdido em R$'; comment on column BSC_FATURAMENTO_PERDAS.referencia is 'Mês de referência da perda'; comment on column BSC_FATURAMENTO_PERDAS.chave_categoria_pai is 'Chave da categoria pai'; comment on column BSC_FATURAMENTO_PERDAS.chave_categoria is 'Chave da categoria'; -- Create/Recreate indexes create index BSC_PERDAS_IDX1 on BSC_FATURAMENTO_PERDAS (REFERENCIA, CHAVE_EMPRESA) tablespace C5DADOS pctfree 10 initrans 2 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 ); create index BSC_PERDAS_IDX2 on BSC_FATURAMENTO_PERDAS (REFERENCIA, CHAVE_CATEGORIA) tablespace C5DADOS pctfree 10 initrans 2 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 ); -- Create/Recreate primary, unique and foreign key constraints alter table BSC_FATURAMENTO_PERDAS add constraint BSC_FATURAMENTO_PERDAS_PK primary key (CHAVE_PERDA) using index tablespace C5DADOS pctfree 10 initrans 2 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 );