Re: How to delete last char in string?
Posted in 1995
> jpowell@cv.hp.com (John Powell) writes: > Here is an SQL puzzle for everyone: > We need to trim the last character from a variable length parameter > that is passed into an SPL stored procedure. We have tried setting > a variable len as: > let len = length(v_parm_name) - 1; > let v_short_parm_name = v_parm_name[1, len]; > On the second line we get a syntax error on len. I have run into the > same problem with a regular SQL statement such as: > > select col1[1, LENGTH(col2)] from table1; > > Any ideas on how to solve this problem? If you can think of any way to > do, please send your ideas. We could write this in SQL, SPL, 4GL, etc. or > if we had to, call a C program. For some incredible reason you can only have constants in substring selectors in spl so "len" will give you a syntax error. There is also no way of calling a C function in spl (short of a system-call) so that's no option either (very very sad, but true). You can of course do all this in 4GL. Dear Informix do you have any plans to extend your SPL language any time soon? We realy need that! Nils.Myklebust@ccmail.telemax.no NM-data, Dalsbergstien 7, N-0170 Oslo, Norway My opinions are those of my company