PostgreSQL:How to return result of a SELECT statement within a function using PostgreSQL? -


here have following function, not getting how return result.

create or replace function f1() returns void   $body$   begin         select "fname",           "lname",            count("city" = 'a-b' or null) "a-b",           count("city" = 'c-d' or null) "c-d",       "table1"        "city" in ('a-b','c-d')       group 1,2       order 1,2   

change return type returns table (fieldname type, fieldname type, ...) , use return query select ....

see the pl/pgsql docs.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -