Return to Snippet

Revision: 50396
at August 19, 2011 16:00 by georgemathewkunnathoor


Initial Code
drop procedure if exists cur_movie;

delimiter //


create procedure cur_movie()
begin
        declare mname varchar(100);
        declare yr int;
        declare flag int default 0;
        declare c cursor for select movie_name,release_year from movie;
        declare exit handler for not found set flag=1;
        open c;

        fetch c into mname, yr;

        loop
                select mname as MovieName ,yr as ReleaseYear;
                fetch c into mname,yr;

        end loop;
        close c;

end //
delimiter ;

Initial URL
http://www.gladsys.in/blog/stored-procedures-in-mysql/

Initial Description

                                

Initial Title
Cursor in Mysql

Initial Tags
mysql

Initial Language
SQL