1

I want a function that select 3 different columns from the same table and returns 3 columns. Instead of that, the function returns one columns which contains 3 strings.

I use Postgresql and pgAdmin4. I wrote a function that take as parameter an integer and use it as WHERE condition in the request. It provides a good result but not yheway I expect.

My function's code:

create or replace function projetdep(dep integer) returns table (projet_nom varchar(100), projet_cdp_ineo varchar(100), projet_cdp_free  varchar(100))
language sql
as
$$
select projet_nom, projet_cdp_ineo,projet_cdp_free from projet where projet_departement = dep;
$$;

alter function projetdep(integer) owner to "userLyess";

And the result displayed is something like that:

("21021_001_01 - ARC SUR TILLE",FB,HS) 

Which is 1 column

However I expect something like that:

21021_001_01 - ARC SUR TILLE;HS;FB   

Which is 3 columns

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.