Re: Function problem

From: "Patrick Hatcher" <PHatcher(at)macys(dot)com>
To: agliodbs(at)openoffice(dot)org
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Function problem
Date: 2002-03-16 02:46:43
Message-ID: OF159EA899.F8BB52E9-ON88256B7E.000EC4EB@fds.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


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(at)openo To: "Patrick Hatcher" <PHatcher(at)macys(dot)com>,
ffice.org> pgsql-novice(at)postgresql(dot)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

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2002-03-16 02:49:57 Re: Function problem
Previous Message Patrick Hatcher 2002-03-16 00:58:28 Function problem