agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Gugu Rama <gulsumramazanoglu@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Can the result sets produced in SQL procedures be left open for the use of the calling program?
Date: Thu, 1 Jun 2017 14:24:36 -0700
Message-ID: <4e782262-9ac5-b007-8a6c-6069588e5cfe@aklaver.com> (raw)
In-Reply-To: <CAG2jv3fNBBa00SeuhUXwd+3TftEPSWkKMEU-eTY-10jfgHahmg@mail.gmail.com>
References: <CAG2jv3fNBBa00SeuhUXwd+3TftEPSWkKMEU-eTY-10jfgHahmg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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....

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-RETURN...

> 
> 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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (2+ messages)

Message-ID: <4e782262-9ac5-b007-8a6c-6069588e5cfe@aklaver.com>
Permalink:  ../4e782262-9ac5-b007-8a6c-6069588e5cfe@aklaver.com/
Also on:    postgresql.org/message-id/4e782262-9ac5-b007-8a6c-6069588e5cfe@aklaver.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: adrian.klaver@aklaver.com, gulsumramazanoglu@gmail.com
  Subject: Re: Can the result sets produced in SQL procedures be left open for the use of the calling program?
  In-Reply-To: <4e782262-9ac5-b007-8a6c-6069588e5cfe@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox