Solved

what is this error mean

Posted on 2009-05-11
5
349 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 500 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PostgreSQL Database design for time based data 8 525
the code run long time but it not delete table 10 290
Mass update Linked Tables in Access 7 563
vcenter 6 u2 install question 1 131
Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
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…
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

734 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