cancel
Showing results for 
Search instead for 
Did you mean: 

while statement

Baron
Participant
0 Kudos
500

Can somebody tell me which mistake am I doing, why I get syntax error with this block?

create or replace procedure myproc()
begin
declare myvar int;
set myvar = 1;
while myvar <10 begin
set myvar= myvar+1;
end;
end;

Accepted Solutions (1)

Accepted Solutions (1)

regdomaratzki
Product and Topic Expert
Product and Topic Expert

You are mixing your Watcom SQL and Transact-SQL into the same procedure. The brackets after the procedure name and the BEGIN..END after the procedure definition is Watcom-SQL, but you're trying to use the Transact-SQL version of the WHILE statement (i.e. no LOOP..END LOOP).

You alternative SQL for the procedure is all Watcom-SQL.

Answers (0)