Re: Foreach & Concactenation
Posted in 2003
Topics: Data Types & Schema Design
Thanks to both of you who replied. Unfortunately varchar is not going to be bug enough (255) and I cannot perform string operations on text variables. Any ideas? Temp table? "Gorazd Hribar Rajteric" <REMOVE_gorazd.hribar@telekom.si> wrote in message news:<rFZcb.3962$2B6.686381@news.siol.net>... > CHAR variables are always as long as they are declared. If new value is too > short, then variable is filled with space characters. What you need to do is > use VARCHAR or CLIP before concatenating: > > ... > FOREACH > SELECT tddesc INTO sDesc FROM TimeDesc WHERE tindex = 2478770 > LET sLongDesc = sLongDesc CLIPPED || sDesc > END FOREACH > ... > > But I prefer using VARCHAR. > > Gorazd
"Steve Schroeder" <zamdrist@pconline.com> wrote in message news:c13afac3.0309291300.3619544c@posting.google.com... > Thanks to both of you who replied. > > Unfortunately varchar is not going to be bug enough (255) and I cannot > perform string operations on text variables. > > Any ideas? Temp table? > > "Gorazd Hribar Rajteric" <REMOVE_gorazd.hribar@telekom.si> wrote in message news:<rFZcb.3962$2B6.686381@news.siol.net>... > > CHAR variables are always as long as they are declared. If new value is too > > short, then variable is filled with space characters. What you need to do is > > use VARCHAR or CLIP before concatenating: > > > > ... > > FOREACH > > SELECT tddesc INTO sDesc FROM TimeDesc WHERE tindex = 2478770 > > LET sLongDesc = sLongDesc CLIPPED || sDesc > > END FOREACH > > ... > > > > But I prefer using VARCHAR. If you are using 9.x, change varchar to LVARCHAR. Depending on the version of Informix you have, you can get anywhere from 2048 bytes to 32K bytes. A big improvement over hopelessly inadequate 255 limit of varchar.