functions - Mailing list pgsql-admin

From C K
Subject functions
Date
Msg-id d3561eb00808020358i48a1cc1n8d69a82dccbd3953@mail.gmail.com
Whole thread Raw
In response to functions  ("C K" <shreeseva.it@gmail.com>)
List 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.



--
Keep your Environment clean and green.

pgsql-admin by date:

Previous
From: giuseppe.derossi@email.it
Date:
Subject: fuzzy search
Next
From: Mathias Stjernström
Date:
Subject: Re: Nls sorting in Postgresql-8.3.3