Re: [SQL] Can the result sets produced in SQL procedures be left openfor the use of the calling program? - Mailing list pgsql-sql

From Adrian Klaver
Subject Re: [SQL] Can the result sets produced in SQL procedures be left openfor the use of the calling program?
Date
Msg-id 4e782262-9ac5-b007-8a6c-6069588e5cfe@aklaver.com
Whole thread Raw
In response to [SQL] Can the result sets produced in SQL procedures be left open for theuse of the calling program?  (Gugu Rama <gulsumramazanoglu@gmail.com>)
List pgsql-sql
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.klaver@aklaver.com



pgsql-sql by date:

Previous
From: Gugu Rama
Date:
Subject: [SQL] Can the result sets produced in SQL procedures be left open for theuse of the calling program?
Next
From: gulsumramazanoglu
Date:
Subject: YNT: Re: [SQL] Can the result sets produced in SQL procedures be left open for the use of the calling program?