This a snippet of a much longer procedure. I am creating a cross-tab of
sales data and dumping it into a temp table. A bunch of other temp tables
are created and then the whole thing is put together in 1 table for
reporting purposes. As stated earlier, it works if I don't put it into a
function and I think it has to do with my quotes (").
Patrick Hatcher
Macys.Com
Legacy Integration Developer
415-932-0610 office
HatcherPT - AIM
"Josh Berkus"
<agliodbs@openo To: "Patrick Hatcher" <PHatcher@macys.com>,
ffice.org> pgsql-novice@postgresql.org
cc:
03/15/2002 Subject: Re: [NOVICE] Function problem
06:00 PM
Patrick,
Frankly, your syntax is wierd enough that I can't figure out what
you're trying to do. Can you explain?
> 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';
-Josh