Subject | I need help-Syntax error - ; |
---|---|
Author | Farshid Dehghan |
Post date | 2012-08-20T22:03:37Z |
Hi
What is the problem with the following code?
Thank you
SET TERM ^ ;
CREATE PROCEDURE SPTR
AS
DECLARE VARIABLE price INTEGER;
DECLARE VARIABLE price1 INTEGER;
DECLARE VARIABLE eid SMALLINT;
DECLARE VARIABLE bsum INTEGER DEFAULT 0;
DECLARE VARIABLE SCTN CURSOR FOR (
Select ID,DBR,CDR
From TBL_Transactions
ORDER BY SDate);
BEGIN
OPEN SCTN;
FETCH SCTN INTO eid, price,price1;
WHILE (1=1) DO
BEGIN
bsum = bsum + (price-price1);
update TBL_TRANSACTIONS set CBALANCE = bsum where Id = eId;
FETCH SCTN INTO eid, price,price1;
END
CLOSE SCTN;
--DEALLOCATE SCTN;
SELECT ID,DBR,CDR FROM TBL_TRANSACTIONS ORDER BY SDate;
SUSPEND;
END^
SET TERM ; ^
What is the problem with the following code?
Thank you
SET TERM ^ ;
CREATE PROCEDURE SPTR
AS
DECLARE VARIABLE price INTEGER;
DECLARE VARIABLE price1 INTEGER;
DECLARE VARIABLE eid SMALLINT;
DECLARE VARIABLE bsum INTEGER DEFAULT 0;
DECLARE VARIABLE SCTN CURSOR FOR (
Select ID,DBR,CDR
From TBL_Transactions
ORDER BY SDate);
BEGIN
OPEN SCTN;
FETCH SCTN INTO eid, price,price1;
WHILE (1=1) DO
BEGIN
bsum = bsum + (price-price1);
update TBL_TRANSACTIONS set CBALANCE = bsum where Id = eId;
FETCH SCTN INTO eid, price,price1;
END
CLOSE SCTN;
--DEALLOCATE SCTN;
SELECT ID,DBR,CDR FROM TBL_TRANSACTIONS ORDER BY SDate;
SUSPEND;
END^
SET TERM ; ^