Re: invalid input syntax for integer: "" - Mailing list pgsql-sql

From scott.marlowe
Subject Re: invalid input syntax for integer: ""
Date
Msg-id Pine.LNX.4.33.0405040857010.30999-100000@css120.ihs.com
Whole thread Raw
In response to invalid input syntax for integer: ""  ("Sebastian Tewes" <stewes@tewes.homelinux.net>)
List pgsql-sql
On Sat, 1 May 2004, Sebastian Tewes wrote:

> Hello :-)
> 
> got a little prob... 
> 
> so my table 
> 
> create table warengruppen ( kennung char (1),
>                                 holder int,
>                      HauptWarenGruppe int,
>                         BezHWG varchar (50),
>                           WarenGruppe int,
>                          BezWG varchar (50));
> 
> 
> the copy syntax 
> 
> copy warengruppen FROM '/usr/pgsql/datanorm.wrg' with DELIMITER ';';
> 
> and a smal part of my 'datanorm.wrg'
> 
> 
> S;;011;Dachsteine+Formst.;;;
> S;;011;;0111;Dachst.glatt(Biber);
> S;;011;;0112;Dachst.glatt(Tegal.);

the problem here is that "" is not an integer. 

0 is.  If you were to write a simple script file to process the input file 
and turn the empty fields into 0s where they should be because they're 
integers you're set.

OR, you can build a temp table with all text columns, import into that, 
then use a select query to change the blank text columns to the character 
0, then import that into the target table.



pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: typecasting numeric(18,4) to varchar/text
Next
From: Martin Knipper
Date:
Subject: Re: typecasting numeric(18,4) to varchar/text