SQL - Stored Procedures and Functions
Given the following SQL cursor code snippet, what will be the output?
Assuming the Employees table has Sales department names: 'Alice', 'Bob', 'Carol'.
DECLARE @Name VARCHAR(50); DECLARE name_cursor CURSOR FOR SELECT Name FROM Employees WHERE Department = 'Sales'; OPEN name_cursor; FETCH NEXT FROM name_cursor INTO @Name; WHILE @@FETCH_STATUS = 0 BEGIN PRINT @Name; FETCH NEXT FROM name_cursor INTO @Name; END CLOSE name_cursor; DEALLOCATE name_cursor;
Assuming the Employees table has Sales department names: 'Alice', 'Bob', 'Carol'.
