Function problem - Mailing list pgsql-novice

From Patrick Hatcher
Subject Function problem
Date
Msg-id OFB1A86938.DB7A97B8-ON88256B7E.0004E514@fds.com
Whole thread Raw
List 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




pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.2 compile problem on HP/UX
Next
From: "Patrick Hatcher"
Date:
Subject: Re: Function problem