Re: How to return a resultset/table from a sql function? - Mailing list pgsql-general

From Joost Kraaijeveld
Subject Re: How to return a resultset/table from a sql function?
Date
Msg-id A3D1526C98B7C1409A687E0943EAC41001EB30@obelix.askesis.nl
Whole thread Raw
In response to How to return a resultset/table from a sql function?  ("Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl>)
List pgsql-general
OK, to answer my own question (typo's possible, works here ;-)):


CREATE TYPE abonnementartikelheader AS  (col1 int4,  col2 int4);

CREATE OR REPLACE FUNCTION getabonnementartikelheader(int4)
RETURNS SETOF abonnementartikelheader AS
'
select
(SELECT COUNT(klantnummer)::int4       FROM abo_klt WHERE abonnement = $1),
(SELECT SUM(aantal_abonnementen)::int4 FROM abo_klt WHERE abonnement = $1);
'
LANGUAGE 'sql' VOLATILE;

Groeten,

Joost

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: index on user defined type
Next
From: Tom Lane
Date:
Subject: Re: index on user defined type