Re: Return Table in StoredProceure/Function

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: İlyas Derse <ilyasderse(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Return Table in StoredProceure/Function
Date: 2019-11-20 15:08:13
Message-ID: CAFj8pRCbrC_T_rHpZMN2=PZr+hy9pfrOuND2C4+2asOztftWdA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

st 20. 11. 2019 v 16:01 odesílatel İlyas Derse <ilyasderse(at)gmail(dot)com>
napsal:

>
> 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;
>
> Thanks.
>

You can returns cursor via OUT variable. That's all. There is not any other
possibility. Procedures in Postgres can returns results only via OUT
variables.

Regards

Pavel

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-11-20 15:18:46 Re: Making "invisible" characters visible ? (psql)
Previous Message Peter J. Holzer 2019-11-20 15:06:52 Re: mysysconf ?