Removing trailing spaces from a character variable defined in a stored procedure
Posted in 1998
Hi,
Is there a way to remove trailing spaces from a *character* variable (not varchar)
defined in a stored procedure.
The TRIM() function does not seem to do the trick. In fact, the definition of a trim
function on a fixed length character states that it would pad it with spaces.
The reason we cannot use *varchar* datatype is due to the fact that we concatenate a lot
(last count 98) variables into one variable and the stored procedure does not seem to like
concatenating a lot of *varchar*. It returns with an error 881 on the LET statement.
Hardware : Sun Ultra 4000
Software : Solaris 2.5.1, Informix Dynamic Server 7.23.UC5
Here is an example(not complete) which gives an 881
------------------------------------------------------
create procedure p1()
-- define var1 thru var98
define var1 varchar(11) ;
define var2 varchar(20) ;
....
define var98 varchar(11) ;
define deleted_row char(1000) ;
let var1="value1 " || "|";
let var2="value2 " || "|";
....
let var98="value98 " || "|"
let deleted_row = var1 || var2 || var3 || ... || var98 (this statement gives a 881
error)
insert into tab1 values (0,deleted_row);
end procedure;
To get around the 881 error, we have to use char datatype for var1 thru var98.
But char datatype has the problem of trailing spaces.
Does the "clipped" work with a LET statement in a stored procedure ? If so, could you
please show me the syntax.
All help appreciated
--
Rajiv Jhaveri (rajivp@qsun.ho.att.com)