我正在尝试将值插入动态生成表的表中,因此还应该根据列名称(动态)将值插入表中,并使用json键功能将其提取出来。桌子?
delimiter $$
create procedure save_insertion1(in _tid int,in _insertion varchar(2000))
begin
declare a,_length,_id int default 0;
declare _value varchar(2) default null;
set _length=json_length(_insertion);
select _length;
set a=0;
while(_length>a) do
set @result=(select json_keys(_insertion));
select @result;
set @column=(select replace(json_extract(@result,concat('$[',a,']')),'"',''));
select @column;
set @value=(select replace(json_extract(_insertion,concat('$.Location')),'"',''));
select @value;
set @ins=('insert into form(',@column,')values(',@value,')');
prepare stmt3 from @ins;
execute stmt3;
end while;
end;$$
错误代码:1241操作数应包含1列
答案 0 :(得分:0)
set @ ins = concat('插入表格(',@ column,')values(',@ value,')');