YNT: Re: Can the result sets produced in SQL procedures be left open for the use of the calling program?

From: gulsumramazanoglu <gulsumramazanoglu(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: YNT: Re: Can the result sets produced in SQL procedures be left open for the use of the calling program?
Date: 2017-06-01 22:51:56
Message-ID: i7by7l471ln8r7alqqxsxawt.1496356138303@email.android.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql



Adrian thank you for your prompt reply and enlightening info.. though i need to read the sql document thorougly, but for now i just looked at the CREATE FUNCTION command and its compatibility note at the end, and saw that there is an iso standard (and also a cross-platform) compatibility issue.. actually it seems none of the databases provide full compatibility for this command (and for more) i think.. is there any other way of writing sql scripts (say functions, procedures..) which will provide compatibility with iso standards and other db.s? I want to write backend stuff in functions and also stick to the standards.. 
Maybe i should ask more specifically: say for instance i want to send some input data to the function and wait for a result set depending on those parameters (inputs).. may i code such a function in a compatible way with iso standards and make it cross-platform as well?Maybe a too naive question, but still i want to ask.. 
Thanks again..
Samsung cihazımdan gönderildi

-------- Orjinal mesaj --------
Kimden: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Tarih: 2 06 2017 12:24 AM (GMT+02:00)
Alıcı: Gugu Rama <gulsumramazanoglu(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Konu: Re: [SQL] Can the result sets produced in SQL procedures be left open
for the use of the calling program?

On 06/01/2017 02:15 PM, Gugu Rama wrote:
> Hi,
>
> May i ask, if I write an hll program and make a call to an sql
> procedure, will the result set which is produced in the sql procedure be
> available for the calling program, after the sql prodecure ends?

FYI, Postgres has User Defined Functions(UDF) not stored procedures:

https://www.postgresql.org/message-id/D960CB61B694CF459DCFB4B0128514C26AB7AE%40exadv11.host.magwien.gv.at

Though it does not matter for this question. The answer is yes you can
return a result set that can be consumed by another application. I do it
all the time using Python as the end consumer. For the builtin language
plpgsql see here:

https://www.postgresql.org/docs/9.6/static/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING

>
> Example:
>
> HLL program body (which undertakes frontend tasks, gets input from the user)
> .
> .
> .
> Call to an SQL procedure (all due backend stuff, which creates a result
> set depending on the input from the user)
> .
> .
> .
> HLL program body (sends the data in the result set to the screen)
>
>
> Thank you..
>
> Gulsum

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Adrian Klaver 2017-06-02 00:07:20 Re: YNT: Re: Can the result sets produced in SQL procedures be left open for the use of the calling program?
Previous Message Adrian Klaver 2017-06-01 21:24:36 Re: Can the result sets produced in SQL procedures be left open for the use of the calling program?