Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

MySQL Cursor Explanation

Share this post!
 Vote this!

A cursor allow us to use set of resultsets returned by mysql query in one by one pattern. With the use of cursor we can perform operations on set of resultset on each returned row.Like you are fetching multiple data by any operation and you want to operate those data in loop. so with the use of cursor you can loops through the results.Cursor is convienient to use when you are performing on a complex resultset.Cursor can be used inside the stored procedures, functions and triggers.

An Main purpose of a cursor is when you want to perform operation in multiple tables for each row with the results of a query operations.Another reason to use cursor is to use when there is some steps in process are optional and you want to perfom those steps on certain rows of query. so with cursor you can fetch the result set and then perform the additional processing only on the rows that require it.Latest Version of MySQL 5 and greater are support cursor.

0 comments:

Post a Comment