Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Koen Van der Elst — — source: Informix-list mailing list archive (1991-1998)
>SELECT columna || columnb
>would concatenate columna and columnb, including any trailing blank
>spaces in columna. In more recent versions (7.1?) of the database:
>
>SELECT trim(columna) || " " || trim(columnb)
>would concatenate the columns and put one space between them.
>
>Try any SELECT with trim(); if you get a syntax error pointing to trim,
>your version of the database doesn't have the feature.
Waytch out : if one of the columns you're contatenating contains a
NULL value, the operation fails !
Solution : create a SPL functions which I call nvl (sorry for the
Oracle terminology)
create procedure nvl(stringvalue char(255)) returning char (255);
if stringvalue is NULL
return ""
else
return stringvalue
end procedure;
Then you can write trim(nvl(columna)) || trim(nvl(columnb)).
Credit for this one goes to Gerrit Verlinden, Support Engineer of
Informix Belgium. He came up with the idea in 4GL, I just adapted it
to SPL.
Koen
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.