select bus_stop from tb_busname where bus_stop = ' &请输入:';
create function getvalue(p_input in varchar2) return varchar2 as begin if instr(p_input,'木材')>1 then return '木材厂'; else return '其它厂'; end if; end; /select bus_stop from tb_busname where bus_stop=getvalue('输入值');
to beckhambobo: sorry,你可能理解错了,我需要表中的值作为参数,举个例子: 有一个存储过程proc_getbusstop(bus_stop in varchar2(20)); 当用户输入诸如木材工厂、香坊木材厂、香坊木材加工工厂等值时,模糊查询程序能识别出来,把这些值当作‘木材厂’来提供给proc_getbusstop,即程序运行proc_getbusstop('木材厂'); 这个要求可以达到吗?谢谢!
create procedure getvalue(p_bus_stop in varchar2) as str varchar2(50); begin if instr(p_bus_stop,'木材')>1 then str:='select * from tb_busname where bus_stop=''木材厂'''; ... else if ..... .. else .. end if; end; /
return varchar2
as
begin
if instr(p_input,'木材')>1 then
return '木材厂';
else
return '其它厂';
end if;
end;
/select bus_stop from tb_busname where bus_stop=getvalue('输入值');
sorry,你可能理解错了,我需要表中的值作为参数,举个例子:
有一个存储过程proc_getbusstop(bus_stop in varchar2(20));
当用户输入诸如木材工厂、香坊木材厂、香坊木材加工工厂等值时,模糊查询程序能识别出来,把这些值当作‘木材厂’来提供给proc_getbusstop,即程序运行proc_getbusstop('木材厂');
这个要求可以达到吗?谢谢!
as
str varchar2(50);
begin
if instr(p_bus_stop,'木材')>1 then
str:='select * from tb_busname where bus_stop=''木材厂''';
...
else if .....
..
else
..
end if;
end;
/