Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 418FB650279 for ; Sat, 2 Aug 2008 07:58:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 46854-03 for ; Sat, 2 Aug 2008 07:58:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by postgresql.org (Postfix) with ESMTP id CA8D8650183 for ; Sat, 2 Aug 2008 07:58:30 -0300 (ADT) Received: by fg-out-1718.google.com with SMTP id 16so993599fgg.23 for ; Sat, 02 Aug 2008 03:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=M8SalbZdayWWiYIi2fqOoDqv81kaQygywc5mV2clykw=; b=VTi6lflsF/FaYxSfjEe8iCB5tzU9aSuLpBTssbIKnHgChnpG50Mjss4jq+2J2itroG LOP9ACBNIOJK4FnwEXPMGUbXwByksqEqOKYFjl0UM2Mp/rU92w+S4k/+KxdlJnsW0bh+ BdPmQ6kqoZsA8V/PXGkdSWhLZERsC9KNxBvgQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=P1eewmn89VKRdlN4cZgoQTm6Ej1xiep/t1nUn+WRiFQIaJrzaiYQXMH63JnHhbzASG Js1So2KC34Drw03Q2sU1S4PaPWsljWeoeF6dpeXEO5acTppEIKpN/IHv61J/fEXhXE/c YH9J539+/cFPF4By0lyTl2BWwr9Zls5xcOwvY= Received: by 10.86.96.18 with SMTP id t18mr8290076fgb.78.1217674709199; Sat, 02 Aug 2008 03:58:29 -0700 (PDT) Received: by 10.86.92.18 with HTTP; Sat, 2 Aug 2008 03:58:29 -0700 (PDT) Message-ID: Date: Sat, 2 Aug 2008 16:28:29 +0530 From: "C K" To: "pgsql-admin@postgresql.org" Subject: functions In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_13378_15351333.1217674709156" References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200808/6 X-Sequence-Number: 29851 ------=_Part_13378_15351333.1217674709156 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. ------=_Part_13378_15351333.1217674709156 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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.
------=_Part_13378_15351333.1217674709156--