On Mon, 16 Jul 2001, Mahdi A. Sbeih wrote:
>I am trying to load data into tables using LOAD statement,
>and I am getting a syntax error from this:
>
>$db_handle->do("load from file insert into mytable")
>
>I spent an hour investigating this, until I found out
>that LOAD and UNLOAD statements can only
>be used from Informix DBAccess, this was a shock for me :-( .

It shouldn't be; the Informix documentation says that's the case.

>Is there any work around, I will not be happy using DBAccess
>since I don't want to use any system calls.

You can't avoid using system calls, but you might well want to avoid
using system() calls -- there is a subtle (but important) difference.

:-)

To load data into a table, you have to prepare an insert statement with
placeholders for the values.  You have to scan the load data file and
split the fields up, then execute the insert statement with the
collected values.  Repeat until EOF.

This is a dreadfully FAQ.

If you need a precise description of the load format, then the best
resource is the file unload.format from the SQLCMD package available
from the IIUG web site (http://www.iiug.org).  It isn't too hard unless
you include blobs, or newlines in your character fields, or you have to
cope with escape characters for the field delimiters.  Then it starts to
get tougher, even in Perl.

-- 
Yours,
Jonathan Leffler ([EMAIL PROTECTED]) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
     "I don't suffer from insanity; I enjoy every minute of it!"


Reply via email to