String concatenation limits...?
Posted in 2000
Topics: Stored Procedures & SPL, Security, Permissions & Auditing, Data Types & Schema Design
Thanks y'all for your help so far. I now have a new problem with my stored
procedures };*)
CREATE PROCEDURE audittrailstr(event INTEGER, comment VARCHAR(255), value
CHAR(4096))
DEFINE details CHAR(8192); LET details=comment || ": " || value;
CALL audittrail(event, details);
END PROCEDURE;
Now whenever I try to call this procedure, no matter how small the actual
values are for "comment" and "value", I get:
881: Resulting string length must be less than or equal to 255.
Is string concatenation limited to 255 characters, or something? I didn't
have any problems before when my strings were all varchar(255)s but now I've
gone up to the 4K an 8K strings it's just not having any of it.
Paul
I asked the following question yesterday. Is the answer beneath everyone's
contempt to answer, or do we genuinely not know? };*)
Paul
Paul Harman <paul@kasterborus.demon.co.uk> wrote in message
news:hmVq4.325$7R.4650@news.colt.net...
> CREATE PROCEDURE audittrailstr(event INTEGER, comment VARCHAR(255), value
> CHAR(4096))
> DEFINE details CHAR(8192);> LET details=comment || ": " || value;
> CALL audittrail(event, details);
> END PROCEDURE;
>
> Now whenever I try to call this procedure, no matter how small the actual
> values are for "comment" and "value", I get:
>
> 881: Resulting string length must be less than or equal to 255.>
> Is string concatenation limited to 255 characters, or something? I didn't
> have any problems before when my strings were all varchar(255)s but now
I've
> gone up to the 4K an 8K strings it's just not having any of it.
Paul Harman <paul@kasterborus.demon.co.uk> wrote in message news:eh9r4.333$7R.4635@news.colt.net... > I asked the following question yesterday. Is the answer beneath everyone's > contempt to answer, or do we genuinely not know? };*) Oh dear, I am using bad netiquette today. Obviously this is a "beneath our contempt" issue because I've finally found it };*) Apparently, TRIM returns a VARCHAR so you can't trim a string that will turn out to be longer than 255 characters. Who's stupid idea was that? Paul
Paul Harman <paul@kasterborus.demon.co.uk> wrote in message news:cs9r4.334$7R.4684@news.colt.net... > Apparently, TRIM returns a VARCHAR so you can't trim a string that will turn > out to be longer than 255 characters. Who's stupid idea was that? Ignore that. I've removed all calls to TRIM() from my stored procedures but I *still* get error 881 [*] thrown when concatenating CHARs and VARCHARs of differing lengths into a (plenty big enough) CHAR. Does anyone have the faintest idea what is going on? Paul [* - according to finderr this is thrown by TRIM if the resulting string is >255 chars, hence my previous message. But I'm not using TRIM any more...]
Hi Paul,
rewrite your stored procedure in this way:
CREATE PROCEDURE audittrailstr(event INTEGER, comment VARCHAR(255),
value CHAR(4096))
DEFINE details CHAR(8192);
LET details=comment;
LET details=trim(details) || ": " || value;
CALL audittrail(event, details);
END PROCEDURE;
I hope it will help, otherwise contact the Informix Support.
regards
Stefan
Paul Harman wrote:
>
> Thanks y'all for your help so far. I now have a new problem with my stored
> procedures };*)
>
> CREATE PROCEDURE audittrailstr(event INTEGER, comment VARCHAR(255), value
> CHAR(4096))
> DEFINE details CHAR(8192);> LET details=comment || ": " || value;
> CALL audittrail(event, details);
> END PROCEDURE;
>
> Now whenever I try to call this procedure, no matter how small the actual
> values are for "comment" and "value", I get:
>
> 881: Resulting string length must be less than or equal to 255.>
> Is string concatenation limited to 255 characters, or something? I didn't
> have any problems before when my strings were all varchar(255)s but now I've
> gone up to the 4K an 8K strings it's just not having any of it.
>
> Paul
In some version of informix sql,a function's param is limited to Char(255),
so I think the problem is value char(4096)!
Paul Harman <paul@kasterborus.demon.co.uk> wrote in message
news:eh9r4.333$7R.4635@news.colt.net...
> I asked the following question yesterday. Is the answer beneath everyone's
> contempt to answer, or do we genuinely not know? };*)
>
> Paul
>
> Paul Harman <paul@kasterborus.demon.co.uk> wrote in message
> news:hmVq4.325$7R.4650@news.colt.net...
> > CREATE PROCEDURE audittrailstr(event INTEGER, comment VARCHAR(255),value
> > CHAR(4096))
> > DEFINE details CHAR(8192);
> > LET details=comment || ": " || value;
> > CALL audittrail(event, details);
> > END PROCEDURE;
> >
> > Now whenever I try to call this procedure, no matter how small the
actual
> > values are for "comment" and "value", I get:
> >
> > 881: Resulting string length must be less than or equal to 255.> >
> > Is string concatenation limited to 255 characters, or something? I
didn't
> > have any problems before when my strings were all varchar(255)s but now
> I've
> > gone up to the 4K an 8K strings it's just not having any of it.
>
>
>