?
Solved

what is this error mean

Posted on 2009-05-11
5
Medium Priority
?
352 Views
Last Modified: 2012-05-06
invalid input syntax for type numeric
what is this error mean
0
Comment
Question by:tankergoblin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:earth man2
ID: 24362007
the parser is is having difficulty transforming one type into a numeric value.
try an explicit cast.
cast( xxx as numeric )
if that fails then you need to look at what characters are in that string.  Is it Nan +Infinity ???
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24371760
i dont know what you mean
can you explain it in detail thank you

what do you mean by cast(xxx as numeric)

and waht is NAN + infinity

0
 
LVL 22

Expert Comment

by:earth man2
ID: 24372133
You have started another thread.  But from the extra information that you have provided there you are trying to equate a numeric column to an empty string, which gives rise to this "invalid input syntax".
(which may be coming from the DBD::PgPP interface)

+- Infinity and Nan are valid IEEE 754 entities.

create table x ( id int, y numeric );

insert into x ( id ) values (1);
insert into x values ( 2, default );
insert into x values ( 3, null );
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24381157
i insert data into database is base on the data in a text file. that mean i m manually add data into database.

example:
in my text file i have

name  mark
alex   54
helen
david 44

how to make it able to read null in mark as numeric data..
0
 
LVL 22

Accepted Solution

by:
earth man2 earned 1500 total points
ID: 24382398
Note: strict use of blanks ie no double blanks used as delimiter and blank after record with null mark.
psql -U postgres -q devdb
devdb=# \! cat csvimport.csv
name mark
alex 54
helen
david 44
devdb=# COPY tablex(name, mark) FROM '/home/postgres/csvimport.csv' DELIMITER AS ' ' NULL AS '' C
SV HEADER;
devdb=# select * from tablex;
 name  | mark
-------+------
 alex  |   54
 helen |
 david |   44
(3 rows)

0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month9 days, 22 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question