gpt4 book ai didi

mysql - 错误代码 1241 - 操作数应包含 1 列

转载 作者:行者123 更新时间:2023-11-29 09:38:55 25 4
gpt4 key购买 nike

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

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的代码,但出现此错误。

最佳答案

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

关于mysql - 错误代码 1241 - 操作数应包含 1 列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57068467/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com