Mysql 错误代码1172-结果由多行组成

Mysql 错误代码1172-结果由多行组成,mysql,Mysql,你好,我很难处理这个存储过程。我得到一个错误:结果由多行组成 以下是我的存储过程: delimiter // create procedure cars1 (in v_tara1 int, in v_an year, in v_combustibil1 enum('b','d'),out vnr varchar(20), out vmid int, out vaf year, out vcomb enum('d','b')) begin select nr_inmatricul

你好,我很难处理这个存储过程。我得到一个错误:结果由多行组成

以下是我的存储过程:

    delimiter //
    create procedure cars1 (in v_tara1 int, in v_an year, in v_combustibil1 enum('b','d'),out vnr varchar(20), out vmid int, out vaf year, out vcomb enum('d','b'))
begin

select nr_inmatriculare, marca.id_tara, an_fabricatie, combustibil into vnr, vmid, vaf, vcomb  from tara,marca,model,tip_motor, masina 
where tara.id_tara=marca.id_tara and marca.id_marca=model.id_marca and model.id_model=tip_motor.id_model and tip_motor.id_tip_motor=masina.id_tip_motor and
an_fabricatie=v_an and combustibil=v_combustibil1 and marca.id_tara=v_tara1; 


end;
//
delimiter ;

call cars1 (1,1997,'d',@a,@b,@c,@d);
错误1172:结果包含多行

我认为解决办法应该是这样的:

delimiter //
create procedure cars (in v_tara1 int, in v_an year, in v_combustibil1 enum('b','d'))
begin
    declare lista varchar (1200) default '';
    declare ok int default 0;
    declare v_nr_inmatriculare varchar(8);
    declare v_tara int;
    declare v_an_fabricatie year;
    declare v_combustibil enum('d','b');
    declare c cursor for select nr_inmatriculare, marca.id_tara, an_fabricatie, combustibil from tara,marca,model,tip_motor, masina 
where tara.id_tara=marca.id_tara and marca.id_marca=model.id_marca and model.id_model=tip_motor.id_model and tip_motor.id_tip_motor=masina.id_tip_motor and
an_fabricatie=v_an and combustibil=v_combustibil1 and marca.id_tara=v_tara1; 
 declare continue handler for not found set ok=1;

open c;
    bucla: loop
        fetch c into v_nr_inmatriculare, v_tara, v_an_fabricatie, v_combustibil;
            if ok =1 then leave bucla;
        else
        set lista = concat(v_nr_inmatriculare,' ', v_tara,' ', v_an_fabricatie,' ',v_combustibil,';',lista);
            end if;

    end loop;
   select lista; 
        close c;
end;
//
delimiter ;

call cars (1,1997,'d');

问题是:您知道输出表而不是列表的任何解决方案吗?

如果需要多行,您总是可以根据SQL查询的结果创建一个临时表。您能举个例子帮助我吗?thx