Subject Re: SP question
Author s.beames@mailbox.gu.edu.au
Hi Sean,
thanks for your time............
>
> You should be able to do it in a single select statement, which
goes:
>
> Select ACCNT_ID, SUM(CHARGE)
> From JOBS
> Where COMPLETED between :startDate and :endDate
> Group By ACCNT_ID
>
> Sean

I can't get this to work. I've tried....

SET TERM !! ;
CREATE PROCEDURE FBS_REPORT_PROC (startDate DATE, endDate DATE)
RETURNS (account SMALLINT, totalCharge DECIMAL(9,3))
AS
BEGIN
Select ACCNT_ID, SUM(CHARGE) into :account, :totalCharge
From JOBS
Where COMPLETED between :startDate and :endDate
Group By ACCNT_ID;
END !!
SET TERM ; !!

and

SET TERM !! ;
CREATE PROCEDURE FBS_REPORT_PROC (startDate DATE, endDate DATE)
AS
BEGIN
Select ACCNT_ID, SUM(CHARGE)
From JOBS
Where COMPLETED between :startDate and :endDate
Group By ACCNT_ID;
END !!
SET TERM ; !!

and various other combinations in my script, but it bombs when run.
Am I even close?

Thanks,
Steve