I get an error message every time I run a WHILE loop code (in Oracle SQL Developer 2005). I got the following code from online examples and the error seems to occur at Line 4 which is where the "BEGIN" statement is.
-- DECLARE @intFlag int
SET @intFlag = 1
WHILE (@intFlag <=5)
BEGIN
PRINT @intFlag
SET @intFlag = @intFlag + 1
IF @intFlag = 4
BREAK;
END
GO
Error message:
Error starting at line 4 in command:
BEGIN
PRINT @intFlag
SET @intFlag = @intFlag + 1
IF @intFlag = 4
BREAK;
END
GO
Error report:
[Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
What could be causing this error? Should I be using a different way to implement the WHILE loop?
Aucun commentaire:
Enregistrer un commentaire