0

我正在创建一个程序,我遇到了这个。有谁知道如何解决这个问题?

delimiter $$
create procedure sp_cadastraAluno(
in nome varchar(150),
in chamada varchar(3),
in data date, 
in ra varchar(12),
in turma varchar(50),
in cpf varchar(14))
begin
    declare x int;
    set x = (select * from tb_coordenador inner join tb_professor
    on tb_coordenador.cd_coord = tb_professor.cd_coord
    inner join prof_turma on
    tb_professor.cd_prof = prof_turma.cd_prof
    inner join tb_turma on
    prof_turma.cd_turma = tb_turma.cd_turma 
    inner join tb_aluno on
    tb_turma.cd_turma = tb_aluno.cd_turma where nm_turma = turma and tb_professor.cd_cpf = cpf);

    insert into tb_aluno(nm_aluno, cd_chamada, dt_nascimento, cd_ra, cd_turma) values
    (nome, chamada, data, ra, x);
end $$

我需要插入,tb_aluno为此,我需要提取已插入的代码tb_turma,但出现此错误。

4

1 回答 1

1

您不能使用多列设置变量“x”。尝试删除 select * 并替换为您需要的列。

于 2019-07-18T04:09:22.683 回答