Skip to content
Advertisement

ERROR: invalid input syntax for type numeric (SQL)

I’ve created a data set with Mockaroo and then added the file with cmd. But I am getting this error. ERROR: invalid input syntax for type numeric: The table definiton is this :

create table car(
id BIGSERIAL NOT NULL PRIMARY KEY,
make VARCHAR(100) NOT NULL,
model VARCHAR(100) NOT NULL,
price NUMERIC(19,2) NOT NULL);

And this is how the numeric number (price) looks like:

insert into car (id, make, model, price) values (1, 'Mercury', 'Grand Marquis', '$52656.16');

I added the cmd screen shot for you to see.

Note : the translated version of the error written in my cmd is:

ERROR: invalid input syntax for type numeric:

p.s : I tried making (19,2) to even (50,20). It did not work.

cmd

Advertisement

Answer

Your price column is numeric and data that you are entering into it is varchar('$52656.16')

Either replace '$52656.16' with numeric value 52656.16 or change price column to varchar.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement