2
I’m having trouble entering records in Oracle, below follows the insert
that I use:
insert into COMPRAS (id, valor, data, observacoes, recebido)
values (id_seq.nextval, 200, '19-FEB-2008', 'MATERIAL ESCOLAR', '1');
However it generated this SQL error;
Erro ao iniciar na linha 1 no comando
insert into COMPRAS (id, valor, data, observacoes, recebido)
values (id_seq.nextval, 200, '19-FEB-2008', 'MATERIAL ESCOLAR', '1')
Relatório de erro:
Erro de SQL: ORA-01858: foi localizado um caractere não numérico onde se esperava um numérico
01858. 00000 - "a non-numeric character was found where a numeric was expected"
*Cause: The input data to be converted using a date format model was
incorrect. The input data did not contain a number where
anumber was required by the format model.
*Action: Fix the input data or the date format model to make sure the
elements match in number and type. Then retry the operation.
My table looks like this:
COMPRAS
Nome Nulo Tipo
----------- -------- ------------
ID NOT NULL NUMBER
VALOR NUMBER
DATA DATE
OBSERVACOES VARCHAR2(30)
RECEBIDO CHAR(1)
This is how the table was created:
create table compras (
id number primary key,
valor number,
data date,
observacao varchar2(30),
recebido char check (recebido in(0,1)));
CREATE SEQUENCE ID_SEQ;
How do I fix it?
Have you tried using the function
TO_DATE()
?TO_DATE('19-Feb-2008', 'DD-Mon-YYYY')
– StillBuggin