Re: PL/pgSQL stored procedure returning multiple result sets (SELECTs)?

From: Artacus <artacus(at)comcast(dot)net>
To: Vladimir Dzhuvinov <vd(at)valan(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PL/pgSQL stored procedure returning multiple result sets (SELECTs)?
Date: 2008-10-13 20:09:53
Message-ID: 48F3AB11.9050003@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> CREATE PROCEDURE list_user_accounts(IN user_id INT)
>
> BEGIN
>
> -- Return first result set (single row)
> SELECT * FROM users WHERE id = user_id;
>
> -- Return second result set (zero or more rows)
> SELECT * FROM accounts WHERE account_holder = user_id;
>
> END;
>
>
> So, is it true that as of Postgresql 8.3 there is no way to have a
> pgpqsql function return multiple SELECTs?
>
>
> Vladimir Dzhuvinov
>
>
Have you considered returning XML instead? You should be able to get
what your looking for much easier with an XMLAGG.

Artacus

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2008-10-13 21:21:27 Re: [GENERAL] Drupal and PostgreSQL - performance issues?
Previous Message Grzegorz Jaśkiewicz 2008-10-13 20:06:08 Re: PL/pgSQL stored procedure returning multiple result sets (SELECTs)?