Re: HELP: Informix 5, Varchar / Char types / Powerbuilder 4
Posted in 1996
Mark D. Stock <marks@west.co.za> wrote in article
<327E65C5.49A8@west.co.za>...
> Clyde H. Bryant wrote:
> > > Hans Nieuwenburg wrote:
> > >
> > > The Informix 5 varchar type can onle be 255 characters long while
the char
> > > type can be mutch longer. In a database we first had a vanchar field
and
> > > converted that to char to enlarge the field to 4096, somehow the
database
> > > comes back with an error when we try to insert a record with text
longer
> > > then 255 characters the message we get is: -280
> > >
> > > This is the meaning of -280 from the informix help file:
> > > "-280
> > >
> > > A quoted string exceeds 256 bytes.
> > >
> > > Somewhere in this statement there is a character literal that
exceeds the
> > > maximum allowed. Inspect the statement, checking the punctuation and
> > > length of all quoted strings. Possibly two quotes are missing,
making a
> > > long string out of two short ones. If you intended to use a string
of
> > > this length, you will have to revise the statement. There is no
means for
> > > writing such a long character string in an SQL statement.
> > > "
> > >
> > > How can we solve this, according to the table configuration this
field is
> > > 4096 bytes long!
> >
> > Sound like the engine still thinks the column type is varchar
> > and not char. Check syscolumns for the data type ("coltype,
> > collength"). I guess you could unload the table then drop the
> > table and re-create it with the column as char(4096) which is
> > a big column. Why not define it as a text column?
>
> No. The problem is axactly what the message says:
>
> A quoted string exceeds 256 bytes.
>
> This is a message from your tool. Define a variable LIKE the column or as
> CHAR(4096). Then assign your text to this variable in segments of upto
256
> chars at a time, such as:
>
> LET var = "first string.....", "second string.....", "etc....."
>
> Then use the variable in your INSERT statement.
>
> Hope that helps,
> --
>
> Mark.
>
>
+-------------------------------------------------------------------------+
> |Mark D. Stock - The West Solutions Group http://www.west.co.za
|
> | The Informix FAQ is at http://www.iiug.org
|
> |mailto:marks@west.co.za
+------------------------------------------------+
> |Tel: +27 11 803 2151 |If it doesn't work... force it!
|
> |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway!
|
> |Cell: +27 83 250 2325 |Well, that's how I code anyway!
|
>
+------------------------+------------------------------------------------+
>
>
This works for me (16bit PB5.0.01):
string ls_test_long_char_insert
ls_test_long_char_insert = ...assign what you nedd ...
insert into test values (1, :ls_test_long_char_insert);
HTH,
Pepa
Josef Dufek
ISS s.r.o., Benesova 2/4, 602 00 Brno, Czech Republic
vondr@issbrno.anet.cz