我有一张表table里面数据如下:
col_1 col_2
a 10
b 11
c 12
d 13
现在有存储过程如下:
create or replace
PROCEDURE CHECK (userid char) as
BEGIN
select col_1,col_2 from table where col_1 in(userid);
END CHECK;现在问题是,如果我传入值 a ,可以得出正确的结果。
请问我想的到 a,c,d的结果该怎么办。我试着传参数 'a','b','c'后,没有任何结果
col_1 col_2
a 10
b 11
c 12
d 13
现在有存储过程如下:
create or replace
PROCEDURE CHECK (userid char) as
BEGIN
select col_1,col_2 from table where col_1 in(userid);
END CHECK;现在问题是,如果我传入值 a ,可以得出正确的结果。
请问我想的到 a,c,d的结果该怎么办。我试着传参数 'a','b','c'后,没有任何结果
在ORACLE看来总是形如select col_1,col_2 from table where col_1 in('a')之类的,
如果你需要获得不同的结果,则需要修改过程:create or replace function sp_testchar(p_name in char) return int
is
i int;
vsql varchar2(4000);
begin
vsql:='select count(*) from table where name in ('||p_name||')';
execute immediate vsql into i ;
return i;
end;