functions

From: "C K" <shreeseva(dot)it(at)gmail(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: functions
Date: 2008-08-02 09:39:50
Message-ID: d3561eb00808020239q6d40ab35h6e76212033f49260@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Mathias Stjernström 2008-08-02 10:39:19 Re: Nls sorting in Postgresql-8.3.3
Previous Message Bhella Paramjeet-PFCW67 2008-08-01 18:59:52 Postgres on polyserve cluster file system