pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rajesh Kumar Mallah <rmallah@trade-india.com>
To: Martin Chantler <MC44@acw.co.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Stored Procedure Question
Date: Wed, 30 Apr 2003 23:33:52 +0530 (IST)
Message-ID: <Pine.LNX.4.33.0304302331270.1176-100000@localhost.localdomain> (raw)
In-Reply-To: <3EAD2E0C@acw.co.uk>



All that is possible.

search google for Set returning functions + postgresql

regds
Mallah.

On Wed, 30 Apr 2003, Martin Chantler wrote:

> Hi all,
> 
> I am confused about Postgres stored procedures (aka functions), can they 
> only return one value???
> All examples I have seen don't return a recordset
> 
> In MS SQL I have many simple procedures that execute SQL given parameters 
> and return
> a recordset, possibly many rows long
> 
> Example:
> CREATE PROCEDURE SECGetMenuItems (@userID as varchar(50)) AS
> Select distinct SECTask.TaskName, MenuDisplay, NodeName, ParentNode, Type, 
> ProcedureName, TaskType, Icon
> From (SECTaskContext inner join SECTask on SECTaskContext.TaskName = 
> SECTask.TaskName)
> left  join 
> ((select Type, TaskName from SECPermission inner join SystemUserDetails AS 
> SUD on SECPermission.UserName = SUD.UserID where SUD.UserID =  @userID)
>  union 
> (select Type, TaskName from SECPermission inner join SECUserGroup on 
> SECPermission.UserName = SECUserGroup.GroupName where 
> SECUserGroup.MemberName =  @userID))
> as Answer on Answer.TaskName = SECTask.TaskName
> Where (Hide = 0
> or Type is not null)
> and Nodename is not null
> order by ParentNode
> 
> My question is, can I get PostGres procedures to do the same thing?
> I am also hoping that they return data to the client in a similar way (I am 
> using ODBC)
> 
> e.g.:
> rs.open "SECGetMenuItems 'MC44'"
> then you can treat rs as a normal recordset
> 
> Thanks for any help,
> 
> Martin Chantler
> 
> 
> -----------------------------------------------------------------------
> Martin Chantler
> Application Developer
> ACW Technology Ltd
> Comines Way
> Hedge End
> Southampton
> Hants  SO30 4XX    U.K.
> 
> Tel:  023 8048 6000                      Fax:  023 8048 6001
> 
> International Tel :  +44 23 8048 6000    Fax : +44 23 8048 6001
> 
> E-mail: mc44@acw.co.uk     Website/URL:  www.acw.co.uk
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 




view thread (4+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0304302331270.1176-100000@localhost.localdomain>
Permalink:  ../Pine.LNX.4.33.0304302331270.1176-100000@localhost.localdomain/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0304302331270.1176-100000@localhost.localdomain

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: rmallah@trade-india.com, MC44@acw.co.uk
  Subject: Re: Stored Procedure Question
  In-Reply-To: <Pine.LNX.4.33.0304302331270.1176-100000@localhost.localdomain>
  References: <3EAD2E0C@acw.co.uk> <Pine.LNX.4.33.0304302331270.1176-100000@localhost.localdomain>

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

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