From: Lennin Caro <lennin.caro@yahoo.com>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
To: C K <shreeseva.it@gmail.com>
Subject: Re: functions
Date: Mon, 4 Aug 2008 06:33:25 -0700 (PDT)
Message-ID: <642766.26746.qm@web59508.mail.ac4.yahoo.com> (raw)
In-Reply-To: <d3561eb00808020239q6d40ab35h6e76212033f49260@mail.gmail.com>
create a type and return this
--- On Sat, 8/2/08, C K <shreeseva.it@gmail.com> wrote:
> From: C K <shreeseva.it@gmail.com>
> Subject: [ADMIN] functions
> To: "pgsql-admin@postgresql.org" <pgsql-admin@postgresql.org>
> Date: Saturday, August 2, 2008, 9:39 AM
> Dear Friends,
> I have written a function as follows. Here I need to get
> the sum of balance
> before the user provided date. The below function works
> well, but returns
> records as a set of values, rather I need individual
> columns. What to do?
> CREATE OR REPLACE FUNCTION aa(date)
> RETURNS SETOF record AS
> $BODY$SELECT docacctransactions.accgroupid,
> Sum(docacctransactions.credit)
> AS OSC, Sum(docacctransactions.debit) AS OSD
> FROM docs INNER JOIN docacctransactions ON docs.docid =
> docacctransactions.docid
> WHERE docs.includeinbalcalc=-1 AND
> docs.transactiontype<>1 AND
> docs.docdate<=$1
> GROUP BY docacctransactions.accgroupid;
> $BODY$
> LANGUAGE 'sql' VOLATILE
> COST 100
> ROWS 1000;
> ALTER FUNCTION aa(date) OWNER TO sa;
>
> I am using WinXP SP 2 with PostgreSQL 8.3 with ODBC
> Please help.
> CPK
> --
> Keep your Environment clean and green.
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-admin@postgresql.org
Cc: lennin.caro@yahoo.com, shreeseva.it@gmail.com
Subject: Re: functions
In-Reply-To: <642766.26746.qm@web59508.mail.ac4.yahoo.com>
* 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