On Fri, 13 May 2016 08:45:46 +0530, Sridhar N Bamandlapally
<sridhar.bn1@gmail.com> wrote:
>we need simple concatenation of all variables(which values may come NULL or
>valid-values based on functional process),
>
>coalesce is different functionality
As Pavel suggested, concat will work, but it swallows NULLs leaving no
trace of them in the output. Using coalesce *with* concat lets you
decide what a NULL will look like:
e.g.,
>> do $$
>> declare
>> txt1 text := 'ABCD';
>> txt2 text := NULL;
>> txt3 text := 'EFGH';
>> txt text := NULL;
>> begin
txt := coalesce( txt1, '' )
|| coalesce( txt2, 'txt2 was null' )
|| coalesce( txt3, '<null>') ;
>> raise notice '%', txt;
>> end$$ language plpgsql;
George