设置定界符号,mysql中的存储过程+游标

xiaoxiao2021-02-28  98

delimiter //  create procedure p6()  begin  declare row_id int;  declare row_username varchar(30);  declare row_details varchar(30);  declare you int default 1;  declare getusers cursor for select id ,username,details from tb_user;  declare continue handler for NOT FOUND set you:=0;  open getusers;  fetch getusers into row_id,row_username,row_details;  repeat  select row_id,row_username,row_details;  fetch getusers into row_id,row_username,row_details;  until you=0 end repeat;  close getusers;  end; //
转载请注明原文地址: https://www.6miu.com/read-71960.html

最新回复(0)