A FETCH
statement fails when the number of variables does not match the number of columns selected in the CURSOR definition.
Noncompliant code example
DECLARE c1 cursor FOR SELECT FirstName, LastName FROM customer;
OPEN c1;
FETCH NEXT FROM c1 INTO @Name; -- Noncompliant
Compliant solution
DECLARE c1 cursor FOR SELECT FirstName, LastName FROM customer;
OPEN c1;
FETCH NEXT FROM c1 INTO @FirstName, @LastName;