limited time offer

MySQL Stored Routine Interview Questions

Showing 1 - 1 of 1 results

What is cursor in MYSQL ?

To handle a result set inside a stored procedure, you use a cursor. A cursor allows you to iterate a set of rows returned by a query and process each row individually.

MySQL cursor is read-only, non-scrollable and asensitive (The server may or may not make a copy of its result table).

How to Declare Cursor

DECLARE cursor_name CURSOR FOR SELECT_statement;

How to Open Cursor

OPEN cursor_name;

FETCH statement to retrieve the next row pointed by the cursor

FETCH cursor_name INTO variables list;

Deactivate the Cursor

CLOSE cursor_name;


Subscribe to MySQL Stored Routine Interview Questions