Subject | Set Term in Stored Procedure creation statement |
---|---|
Author | robertgilland |
Post date | 2003-11-03T23:53:37Z |
The following code works fine in IBConsole (6.0.1.6)
But falls over in IBQuery saying
Token unknown - line 1, char 4
TERM
I have no Ideas. Can anyone help?
BTW without Set Term not even IBConsole works.
Regards,
Robert
SET TERM ^;
CREATE PROCEDURE NETSALES
RETURNS
(
STOREID CHAR(10),
SALESDATE TIMESTAMP,
READSALES FLOAT,
BALANCEDSALES FLOAT,
GST FLOAT
)
AS
BEGIN
FOR
SELECT A.STOREID, A.SALESDATE,
(A.GROSSSALES- A.CANCELS+ A.VOIDS+ (A.RETURNSSELL*2)+
(A.REFUNDS*2)-A.ROUNDING) AS READSALES,
(B.GROSSSALES- B.CANCELS+ B.VOIDS+ (B.RETURNSSELL*2)+
(B.REFUNDS*2)-B.ROUNDING) AS BALANCEDSALES,
A.GST
FROM TOTALS A LEFT JOIN TOTALS B ON
(A.STOREID=B.STOREID) AND
(A.SALESDATE=B.SALESDATE) AND
(A.BALANCED<>'Y') AND
(B.BALANCED='Y')
WHERE
(A.BALANCED<>'Y')
INTO :STOREID, :SALESDATE,:READSALES,:BALANCEDSALES,:GST
DO SUSPEND;
END ^
But falls over in IBQuery saying
Token unknown - line 1, char 4
TERM
I have no Ideas. Can anyone help?
BTW without Set Term not even IBConsole works.
Regards,
Robert
SET TERM ^;
CREATE PROCEDURE NETSALES
RETURNS
(
STOREID CHAR(10),
SALESDATE TIMESTAMP,
READSALES FLOAT,
BALANCEDSALES FLOAT,
GST FLOAT
)
AS
BEGIN
FOR
SELECT A.STOREID, A.SALESDATE,
(A.GROSSSALES- A.CANCELS+ A.VOIDS+ (A.RETURNSSELL*2)+
(A.REFUNDS*2)-A.ROUNDING) AS READSALES,
(B.GROSSSALES- B.CANCELS+ B.VOIDS+ (B.RETURNSSELL*2)+
(B.REFUNDS*2)-B.ROUNDING) AS BALANCEDSALES,
A.GST
FROM TOTALS A LEFT JOIN TOTALS B ON
(A.STOREID=B.STOREID) AND
(A.SALESDATE=B.SALESDATE) AND
(A.BALANCED<>'Y') AND
(B.BALANCED='Y')
WHERE
(A.BALANCED<>'Y')
INTO :STOREID, :SALESDATE,:READSALES,:BALANCEDSALES,:GST
DO SUSPEND;
END ^