Function problem

From: "Patrick Hatcher" <PHatcher(at)macys(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Function problem
Date: 2002-03-16 00:58:28
Message-ID: OFB1A86938.DB7A97B8-ON88256B7E.0004E514@fds.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Howdy all,

I have a function that worked as regular SQL before I tried to make it a
function. I suspect it has something to do with the literal strings I'm
looking at, but I can't figure it out. every time I run the function, I
get an error message on the word TEMP. I've tried removing the word temp
but then the error jumps to crossYTD. I've tried making the literals
single quotes, but that doesn't seem to work. Any suggestions? TIA.

Create Function sp_ddw_crosstab() RETURNS int4 AS '

BEGIN

/* Create the cross tab of YTD data */
Select Item_UPC, Cat_Desc,Pat_Desc,
Sum( Case Appl_ID When "NET" Then RESERVEDUNITS1 Else 0 End) as
Loc128_Demand,
Sum( Case Appl_ID When "NET" Then RESERVEDDOLLARS Else 0 End) as
Loc128_DemandDollar
into TEMP crossytd
From salesYTD q
Group by Item_UPC,Cat_Desc,Pat_Desc;
return 1;

END;
'LANGUAGE 'plpgsql';

Patrick Hatcher
Macys.Com
Legacy Integration Developer
415-932-0610 office
HatcherPT - AIM

Browse pgsql-novice by date

  From Date Subject
Next Message Patrick Hatcher 2002-03-16 02:46:43 Re: Function problem
Previous Message Tom Lane 2002-03-15 23:16:33 Re: 7.2 compile problem on HP/UX