0

I have two functions, qdgc_getlonlat and qdgc_getrecursivestring, which separately return a string. I am now creating a new function where the goal is concatenate the results from the said functions. This is where I am now:

return query 
  select * 
  from qdgc_getlonlat(lon_value,lat_value) 
  union distinct 
  select * 
  from qdgc_getrecursivestring(lon_value,lat_value,depthlevel,'');

Unfortunately it returns an array which look slike this:

enter image description here

Not too bad, but I would like the functions to be returned as a concatenated text string like this:

E007S05BDCA

How can I do this?

ragnvald
  • 113
  • 4
  • `union` will add rows. IF you can manage to get two columsn, try this https://stackoverflow.com/a/26792631/1897935 – Srinath Ganesh Jan 15 '21 at 13:00
  • @SrinathGanesh thanks, but calling two functions seem to mess it up. Considered calling them separately and then concatenating with string handling. But I can not see how it should be done. I should mention that I am not a professional programmer. – ragnvald Jan 15 '21 at 13:14
  • 1
    Does @S-Man solution solve it? it looks right – Srinath Ganesh Jan 15 '21 at 14:29

1 Answers1

2

Why not simply concatenate them?

SELECT
    qdgc_getlonlat(lon_value,lat_value)  || qdgc_getrecursivestring(lon_value,lat_value,depthlevel,'')
FROM
    mytable
S-Man
  • 22,521
  • 7
  • 40
  • 63