-4
這是我的SP當我運行它,我得到的錯誤:這是我的SP ..am得到結果由一個以上的row.please的幫我
result consisted of multiple rows
CREATE DEFINER=`root`@`localhost` PROCEDURE `fourandfive`(IN choice varchar(10), IN upcstring varchar(100), IN Skustring varchar(100))
BEGIN
set @numberofUpcs = length(upcstring);
set @numberofSkus = length(Skustring);
DROP TEMPORARY TABLE IF EXISTS upcs;
create temporary table upcs (upcValue varchar(20));
while (@numberofUpcs>0) do
set @oneupc = substring_index(upcstring,',',1);
insert into upcs values(@oneupc);
set @next = substr(upcstring,1,length(@oneupc)+1);
set upcstring = replace(upcstring,@next,'');
#select @next, @oneupc, upcstring;
set @numberofUpcs = length(upcstring);
end while;
DROP TEMPORARY TABLE IF EXISTS skus;
create temporary table skus (skuValue varchar(20));
while (@numberofSkus>0) do
set @onesku = substring_index(Skustring,',',1);
insert into skus values(@onesku);
set @next = substr(Skustring,1,length(@onesku)+1);
set Skustring = replace(Skustring,@next,'');
#select @next, @oneupc, upcstring;
set @numberofSkus = length(Skustring);
end while;
select count(*) from upcs into @upclen;
#final loop
while(@upclen>=1) do
select upcValue into @Upc from upcs limit 1;
select skuValue into @Sku from skus limit 1;
IF(choice='four') THEN
select shipping into @shipping from store_data where upc = @Upc and sku = @Sku limit 1;
select ([email protected]) into @reprice from prices where upc = @Upc and sku = @Sku limit 1;
update revised_price set price = @reprice where upc = @Upc;
delete from skus where skuValue = @Sku;
set @Sku = 0;
#select @shipping,@reprice;
ELSE IF(choice = 'five') then
select min(price) into @minimumprice from prices where upc= @Upc group by upc;
update revised_price set price = @minimumprice where upc = @Upc;
end if;
end if;
set @upclen = @upclen-1;
delete from upcs where upcValue = @Upc;
set @Upc = 0;
end while;
drop table upcs;
drop table skus;
END
請不要指望我們找到錯誤發生的位置,但指向我們的位置! – Shadow