Solved

what is this error mean

Posted on 2009-05-11
5
344 Views
Last Modified: 2012-05-06
invalid input syntax for type numeric
what is this error mean
0
Comment
Question by:tankergoblin
  • 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now