一个简单的存储过程
BEGINselect * from sell where depot_id in(_depot_id);END过程名为:abc
depot_id 为 int
请问怎么用 call 调用才正确呢?call abc('0,1,7') 结果不正确
call abc(1) 或 call abc('1') 正确怎么调用才能让 call abc('0,1,7') 的结果正确呢?
BEGINselect * from sell where depot_id in(_depot_id);END过程名为:abc
depot_id 为 int
请问怎么用 call 调用才正确呢?call abc('0,1,7') 结果不正确
call abc(1) 或 call abc('1') 正确怎么调用才能让 call abc('0,1,7') 的结果正确呢?
prepare qq from @ee
execute qqor用INSTR、FIND_IN_SET
(
in _depot_id varchar(500)
)
begin
select * from sell where find_in_set in(depot_id, _depot_id) > 0;
end;
(
in _depot_id varchar(500)
)
begin
set @str=concat('select * from sell where depot_id in (',_depot_id,')';
prepare st from @str;
execute st;
deallocate prepare st;
end;
create procedure abc(in _depot_id varchar(500))
begin
set @tmpsql=concat('select * from sell a where a.depot_id in (',_depot_id,')');
prepare sqlstr from @tmpsql;
EXECUTE strsql ;
end;