Re: Return Table in StoredProceure/Function

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Return Table in StoredProceure/Function
Date: 2019-11-20 15:20:08
Message-ID: 98ae35b4-8a72-a28d-5902-3f014604c531@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

İlyas Derse schrieb am 20.11.2019 um 09:18:

> How can I return table in Stored Procedure ? I can do it in function but I
> have inout parameters.So I can not create in function. What can I do this
> case ?
>
> I guess,It should be like for function :
>
> CREATE or REPLACE FUNCTION public."test" (INOUT "x" integer, INOUT "y" text)
>
> RETURNS TABLE ("id" integer,"filesize" character varying(36))AS $$
> BEGINRETURN QUERYSELECT * FROM public."tbl_employees" ;
> END;$$ LANGUAGE plpgsql;
>

Procedures aren't meant to return anything (in Postgres specifically and in Computer Science in general).

If you want to return something use a function.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-11-20 15:21:19 Re:
Previous Message Adrian Klaver 2019-11-20 15:18:46 Re: Making "invisible" characters visible ? (psql)