Table is not generated in Oracle database

0

This normal wheel:

create table M_VENDEDORES (
ID_VENDEDOR number (10,0) not null,
NOME varchar2 (100) not null,
CPF number (11,0) not null,
ENDERECO varchar2 (100) not null,
NUMERO varchar2 (10) not null,
CEP number (11,0) not null,
constraint PK_VENDEDOR PRIMARY KEY (ID_VENDEDOR),
constraint UK_CPF unique (CPF)
);

This normal wheel:

create table M_VENDAS (
ID_VENDEDOR number (10,0) not null,
MES varchar2 (100) not null,
VENDAS number (10) not null,
constraint FK_ID_VENDEDORES foreign key (ID_VENDEDOR)
references M_VENDEDORES (ID_VENDEDOR)
);

This normal wheel:

create table M_FORNECEDORES (
ID_FORNECEDOR number (10,0) not null,
NOME varchar2 (100) not null,
CNPJ number (14) not null,
constraint PK_FORNECEDOR PRIMARY KEY (ID_FORNECEDOR)
);

This does not run normally:

create table M_ESTOQUE (
ID_FORNECEDOR number (10,0) not null,
ID_ITEM number (10,0) not null,
NOME varchar2 (100) not null,
MODELO varchar2 (100) not null,
TAMANHO varchar2 (10) not null,
MARCA varchar2 (100) not null,
ESTOQUE number (100) not null,
constraint PK_ITEM PRIMARY KEY (ID_ITEM),
constraint FK_ID_FORNECEDOR foreign key (ID_FORNECEDOR)
references M_FORNECEDORES (ID_FORNECEDOR)
);

Returns this error:

Log do erro: create table M_ESTOQUE (
ESTOQUE number (100,0)
)
Relatório de erros -
ORA-01727: o especificador de precisão numérica está fora da faixa válida (1 a 38)
01727. 00000 -  "numeric precision specifier is out of range (1 to 38)"
*Cause:    
*Action:
    
asked by anonymous 23.10.2017 / 00:32

1 answer

1

Your problem is here:

ESTOQUE number (100) not null,

A 100-digit number is beyond what Oracle can process. Its limit is 38 digits.

There are two possible outputs:

  • Decrease the size of the field.

  • Change it to varchar2 .

If this field will only store a code of something (even if this code is a string of digits), I recommend using varchar2 (maybe it's the cases of the CEP , CPF , and CNPJ fields) .

If this field represents the quantity in stock of a product, working with 100 digits is an exaggeration and a much smaller number of digits (such as 10) would be more than enough.

    
23.10.2017 / 00:43