-- Create table create table BSC_FATURAMENTO ( chave_faturamento NUMBER(15) not null, chave_empresa NUMBER(15) not null, categoria_pai VARCHAR2(200) not null, categoria VARCHAR2(300), chave_produto NUMBER(15), descricao_produto VARCHAR2(300), chave_familia NUMBER(15), quantidade NUMBER(15,2), valor_venda NUMBER(15,2), valor_bruto 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.chave_faturamento is 'Chave da tabela'; comment on column BSC_FATURAMENTO.chave_empresa is 'Código da loja'; comment on column BSC_FATURAMENTO.categoria_pai is 'Descrição da categoria pai'; comment on column BSC_FATURAMENTO.categoria is 'Descrição da categoria'; comment on column BSC_FATURAMENTO.chave_produto is 'Código do produto'; comment on column BSC_FATURAMENTO.descricao_produto is 'Descrição do Produto'; comment on column BSC_FATURAMENTO.chave_familia is 'Código da família do produto'; comment on column BSC_FATURAMENTO.quantidade is 'Quanitdade vendida'; comment on column BSC_FATURAMENTO.valor_venda is 'Valor toral vendido'; comment on column BSC_FATURAMENTO.valor_bruto is 'Valor bruto vendido'; comment on column BSC_FATURAMENTO.referencia is 'Mês de referência do faturamento'; comment on column BSC_FATURAMENTO.chave_categoria_pai is 'Código da categoria pai'; comment on column BSC_FATURAMENTO.chave_categoria is 'Código da categoria'; -- Create/Recreate indexes create index BSC_FATURAMENTO_IDX on BSC_FATURAMENTO (CHAVE_CATEGORIA) tablespace C5DADOS pctfree 10 initrans 2 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 ); create index BSC_FATURAMENTO_IDX1 on BSC_FATURAMENTO (REFERENCIA) tablespace C5DADOS pctfree 10 initrans 2 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 ); create index BSC_FATURAMENTO_IDX2 on BSC_FATURAMENTO (REFERENCIA, CHAVE_CATEGORIA) tablespace C5DADOS pctfree 10 initrans 2 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 ); create index BSC_FATURAMENTO_IDX3 on BSC_FATURAMENTO (REFERENCIA, CHAVE_EMPRESA) 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 add constraint BSC_FATURAMENTO_PK primary key (CHAVE_FATURAMENTO) using index tablespace C5DADOS pctfree 10 initrans 2 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 );