insert a row with more than 256 char
Posted in 1999
Topics: General Discussion
Hi, I have create table with a field of size 1000 charecters.when I try to insert a row using insert statement ie insert into <table> values("800 char").it is giving me an error the string in the quotes exceed 256 bytes.But when I put the same 800 charecters in a ascii file and the load it using load statement it gets loaded with out any problem. Can any one suggest me how to do it using insert statement. Thanks in advance Shiller
P Shiller wrote:
>
> Hi,
> I have create table with a field of size 1000 charecters.when I try
> to insert a row using
> insert statement ie insert into <table> values("800 char").it is giving
> me an error the string in the quotes exceed 256 bytes.But when I put the
> same 800 charecters in a ascii file and the load it using load statement
> it gets loaded with out any problem.
This is a dbaccess limit. You can code the insert in 4Gl or ESQL/C or
use Jonathan Leffler's sqlcmd which do not have the same restriction.
Art S. Kagel
"Art S. Kagel" wrote:
> P Shiller wrote:
> > I have create table with a field of size 1000 charecters.when I try
> > to insert a row using
> > insert statement ie insert into <table> values("800 char").it is giving
> > me an error the string in the quotes exceed 256 bytes.But when I put the
> > same 800 charecters in a ascii file and the load it using load statement
> > it gets loaded with out any problem.
>
> This is a dbaccess limit. You can code the insert in 4Gl or ESQL/C or
> use Jonathan Leffler's sqlcmd which do not have the same restriction.
Although I'm occasionally successful at performing miracles, this is one I
can't claim credit for :-)
The limit is actually not in DB-Access but in the SQL parser; you cannot
create a literal string which is more than 256 characters long in most current
versions of Informix products (I reserve the right to be wrong about IDS.2000
and Foundation.2000 because I think some work is being done on this or related
areas, such as new lines in the string). The only way around this limitation
is to pass the string to the SQL as a parameter; the SQL statement is
prepared, contains at least one placeholder '?' in the VALUES list, and you
specify the big string as the corresponding parameter.
This can be done in ESQL/C, or I4GL.
Neither DB-Access nor SQLCMD has variables or placeholders in the SQL they
handle, so neither can get around this problem. You need a programming
language to get at this. On the other hand, DBD::Informix is OK...
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.62 -- see http://www.perl.com/CPAN
#include <disclaimer.h>