
July 8th, 2004, 12:01 PM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 9
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Using While Loop
I am trying to create a simple loop that simply goes through the loop incrementing minLoanRecordID by one each time. I am receiving 4 Error messages when trying to run they are:
-Line 2: Incorrect syntax near the keyword 'BEGIN'.
-Line 4: 'INTEGER' is not a recognized CURSOR option.
-Line 5: 'INTEGER' is not a recognized CURSOR option.
-Line 15: Incorrect syntax near '='.
Any Help would be greatly appreciated.
Code:
CREATE PROCEDURE LOOPING
BEGIN
DECLARE maxLoanRecordID INTEGER DEFAULT = 999;
DECLARE minLoanRecordID INTEGER DEFAULT = 0;
WHILE (minLoanRecordID) < (maxLoanRecordID)
SELECT * FROM DU_Requestfile
WHERE RequestID != (SELECT MAX(RequestID) FROM DU_Requestfile
WHERE loanRecordID = minLoanRecordID)
AND LoanRecordID = minLoanRecordID
ORDER BY RequestID
SET minLoanRecordID = minLoanRecordID + 1
END WHILE;
END
|