Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Informix - load command

292 views
Skip to first unread message

Yeo Hwee Kiong

unread,
Jul 10, 2002, 9:42:40 AM7/10/02
to

Can anybody help me inregards to the following issues:-

I have a file as follows:-

Line 1 This is a Test
Line 2
Line 3 The End

I'm running the Informix on SCO OpenServer 5.x.

When try to load the above mentioned files to a table, I always get the
following error.

846: Number of values in load file is not equal to number of columns.
847: Error in load file line 2.


Please help!!!!!

Thanks

Leon Pappadopoulos

unread,
Jul 10, 2002, 10:01:26 AM7/10/02
to

Hi Yeo

You could place a | at the end of each line and load it then.

so it would look like:

Line 1 This is a Test|
Line 2 |
Line 3 The End|

the delimiter is the | symbol

Cheers

Leon

- .... .. ... - --- --- ... .... .- .-.. .-.. .--. .- ... ...

Colin Bull

unread,
Jul 10, 2002, 10:14:44 AM7/10/02
to

What command are you using to load the data in, and are you
specifying a delimiter?

How many fields in your table?

As informix usually defaults to the pipe '|' delimiter, your
data would probably be better as

Line 1 | This is a Test
Line 2 |
Line 3 | The End

if it is 2 fields.

Colin Bull
c.b...@VideoNetworks.com

David Ranney

unread,
Jul 10, 2002, 10:52:19 AM7/10/02
to

Can you provide more information about the table you're loading
into?

--
----------------------------------------------------------------------
David Ranney
d...@bayarea.net

Mark D. Stock

unread,
Jul 10, 2002, 12:20:13 PM7/10/02
to

Yeo Hwee Kiong wrote:
>
> Can anybody help me inregards to the following issues:-
>
> I have a file as follows:-
>
> Line 1 This is a Test
> Line 2
> Line 3 The End

Exactly like that?

> I'm running the Informix on SCO OpenServer 5.x.
>
> When try to load the above mentioned files to a table, I always get the
> following error.
>
> 846: Number of values in load file is not equal to number of columns.
> 847: Error in load file line 2.

What command are you using to load and what file format is it expecting?
If it is expecting delimited, then you need delimiters in your file. I
would expect at least one delimiter at the end of each line.

Cheers,
--
Mark.

+----------------------------------------------------------+-----------+
| Mark D. Stock mailto:mds...@MydasSolutions.com |//////// /|
| Mydas Solutions Ltd http://MydasSolutions.com |///// / //|
| +-----------------------------------+//// / ///|
| |We value your comments, which have |/// / ////|
| |been recorded and automatically |// / /////|
| |emailed back to us for our records.|/ ////////|
+----------------------+-----------------------------------+-----------+

Yeo Hwee Kiong

unread,
Jul 10, 2002, 8:53:32 PM7/10/02
to

As the file that need to be uploaded is very huge, it contains more than
1000 A4 pages after printed.

So if I were to do 1 by 1, it will be very tedious and this is not only 1
time off.

Therefore, I need a solution whether it is from Informix or a script from
Unix to add that | into the blank line. And the problem will be solved bu
itself.

Appreciate your help.

----- Original Message -----
From: "Leon Pappadopoulos" <le...@nja.co.za>
To: "Yeo Hwee Kiong" <hk...@penguin.com.sg>; <inform...@iiug.org>
Sent: Wednesday, July 10, 2002 10:01 PM
Subject: RE: Informix - load command


> Hi Yeo
>
> You could place a | at the end of each line and load it then.
>
> so it would look like:
>

> Line 1 This is a Test|
> Line 2 |
> Line 3 The End|
>

> the delimiter is the | symbol
>
> Cheers
>
> Leon
>
> - .... .. ... - --- --- ... .... .- .-.. .-.. .--. .- ... ...
>
> -----Original Message-----
> From: Yeo Hwee Kiong [mailto:hk...@penguin.com.sg]
> Sent: Wednesday, July 10, 2002 3:43 PM

> To: inform...@iiug.org
> Subject: Informix - load command
>
>

> Can anybody help me inregards to the following issues:-
>
> I have a file as follows:-
>
> Line 1 This is a Test
> Line 2
> Line 3 The End
>

> I'm running the Informix on SCO OpenServer 5.x.
>
> When try to load the above mentioned files to a table, I always get the
> following error.
>
> 846: Number of values in load file is not equal to number of columns.
> 847: Error in load file line 2.
>
>

> Please help!!!!!
>
> Thanks
>

H...@necbns.com

unread,
Jul 10, 2002, 10:19:12 PM7/10/02
to

Hi Yeo,

You can use simple UNIX commands to add '|' at end of the line.

cat filename | sed 's/$/\|/'

-Hai

Tsutomu Ogiwara

unread,
Jul 10, 2002, 10:59:25 PM7/10/02
to

Hi Yeo.

Try the following.

file b contains
1
2
3

% nawk '{ printf ("%s|\n", $0);}' < b
1|
2|
3|

% nawk '{ printf ("%s|\n", $0);}' < b > other file

PS. If you use Solaris, use nawk. Else use awk.

HTH.


--
Tsutomu Ogiwara from Japan.


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

Yeo Hwee Kiong

unread,
Jul 10, 2002, 11:29:13 PM7/10/02
to

Thankyou very much.

It works beatifully.

----- Original Message -----
From: <H...@necbns.com>
To: <hk...@penguin.com.sg>; <le...@nja.co.za>; <inform...@iiug.org>
Sent: Thursday, July 11, 2002 10:19 AM
Subject: RE: Informix - load command

> Hi Yeo,
>
> You can use simple UNIX commands to add '|' at end of the line.
>
> cat filename | sed 's/$/\|/'
>
> -Hai
>

> -----Original Message-----
> From: Yeo Hwee Kiong [mailto:hk...@penguin.com.sg]

> Sent: Wednesday, July 10, 2002 5:54 PM

> To: Leon Pappadopoulos; inform...@iiug.org
> Subject: Re: Informix - load command
>
>

Yeo Hwee Kiong

unread,
Jul 10, 2002, 11:40:36 PM7/10/02
to

Very good.

Thank you very much.


----- Original Message -----
From: "Tsutomu Ogiwara" <tsutomu...@hotmail.com>
To: <hk...@penguin.com.sg>; <le...@nja.co.za>; <inform...@iiug.org>
Sent: Thursday, July 11, 2002 10:59 AM
Subject: Re: Informix - load command

> Hi Yeo.
>
> Try the following.
>
> file b contains
> 1
> 2
> 3
>
> % nawk '{ printf ("%s|\n", $0);}' < b
> 1|
> 2|
> 3|
>
> % nawk '{ printf ("%s|\n", $0);}' < b > other file
>
> PS. If you use Solaris, use nawk. Else use awk.
>
> HTH.
>
> >From: "Yeo Hwee Kiong" <hk...@penguin.com.sg>
> >Reply-To: "Yeo Hwee Kiong" <hk...@penguin.com.sg>

> >To: "Leon Pappadopoulos" <le...@nja.co.za>, <inform...@iiug.org>
> >Subject: Re: Informix - load command

> >Date: Thu, 11 Jul 2002 08:53:32 +0800
> >

0 new messages