1
我已經在MySQL中創建一個存儲過程,如:MySQL存儲過程給運行時錯誤
delimiter $$
drop procedure if exists test9$$
Create procedure test9(test_type varchar(20))
Reads sql data
begin
Declare 1_id int;
Declare 1_date varchar(20);
Declare done int default 0;
Declare cur1 cursor for
select id,name from buyers where ticket_type='test_type';
Declare Continue handler for not found set done=1;
Create temporary table if not exists ticketninja.history2(n_id int,n_date varchar(20));
Open cur1;
hist_loop:loop
fetch cur1 into 1_id,1_date;
if done=1 then
leave hist_loop;
end if;
insert into ticketninja.history2(n_id ,n_date) values(1_id,1_date);
End loop hist_loop;
close cur1;
select * from history2;
drop table history2;
End;
$$
delimiter ;
,但是當我把它用,
call test9('platinum');
它返回一個錯誤說:
#1312 - PROCEDURE ticketninja.test1 can't return
a result set in the given context
我在做什麼錯在這裏?
即使OUT變量它不工作我做了以下方式變化: CREATE PROCEDURE test9(出test_type VARCHAR(20)) – Kalx 2010-06-29 05:45:30