-- Create table create table BSC_FATURAMENTO_METAS ( chave_meta NUMBER(10) not null, chave_empresa NUMBER(10) not null, categoria VARCHAR2(300) not null, meta_faturamento NUMBER(25,10), meta_markdown NUMBER(25,10), referencia DATE not null, total_faturamento NUMBER(25,10), total_markdown NUMBER(25,10), categoria_pai VARCHAR2(200), 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_METAS.chave_meta is 'Chave da meta'; comment on column BSC_FATURAMENTO_METAS.chave_empresa is 'Código da Loja'; comment on column BSC_FATURAMENTO_METAS.categoria is 'Categoria do fatumento'; comment on column BSC_FATURAMENTO_METAS.meta_faturamento is 'Meta para faturamento na referência'; comment on column BSC_FATURAMENTO_METAS.meta_markdown is 'Meta para makdown na referência'; comment on column BSC_FATURAMENTO_METAS.referencia is 'Mês de referência da meta'; comment on column BSC_FATURAMENTO_METAS.total_faturamento is 'Valor total a ser faturado'; comment on column BSC_FATURAMENTO_METAS.total_markdown is 'Valor Markdown'; comment on column BSC_FATURAMENTO_METAS.categoria_pai is 'Categoria pai do faturamento'; comment on column BSC_FATURAMENTO_METAS.chave_categoria_pai is 'Chave da categoria pai'; comment on column BSC_FATURAMENTO_METAS.chave_categoria is 'Chave da categoria'; -- Create/Recreate indexes create index BCS_FATURAMENTO_METAS_IDX on BSC_FATURAMENTO_METAS (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_METAS_IDX1 on BSC_FATURAMENTO_METAS (REFERENCIA) tablespace C5DADOS pctfree 10 initrans 2 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 ); create index BSC_FATURAMENTO_METAS_IDX2 on BSC_FATURAMENTO_METAS (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_FATURAMENTO_METAS_IDX3 on BSC_FATURAMENTO_METAS (REFERENCIA, CHAVE_EMPRESA, 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_METAS add constraint BSC_FATURAMENTO_METAS_PK primary key (CHAVE_META) using index tablespace C5DADOS pctfree 10 initrans 2 maxtrans 255 storage ( initial 128K next 128K minextents 1 maxextents unlimited pctincrease 0 );