Search Postgresql Archives

concat strings but spaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Moin,

I try to concat values from three fields in a function like this:

create or replace function 
 fconcat_name(varchar, varchar, varchar) returns varchar as '
    declare
	ttl alias for $1;
	vnm alias for $2;
	nme alias for $3;
    begin
     return ttl || '' '' || vnm || '' '' || nme;
    end;
' language plpgsql;

That works but if one of the fields is empty there are to much
spaces in the result. Is there any alternative to a monster
if-then construct?

Many thanks
Matthias



---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux