下面这个function是一个去掉字符串里面的“&”符号的,你稍微修改就可以了。create or replace function testdeptstr(p_deptname in varchar2) return varchar2 is
Result varchar2(40);
begin
if instr(p_deptname,'&')>0 then
Result :=testdeptstr(substr(p_deptname,0,instr(p_deptname,'&')-1)||'_'||substr(p_deptname,instr(p_deptname,'&')+1,length(p_deptname)));
else
Result := p_deptname;
end if;
return(Result);
end testdeptstr;
Result varchar2(40);
begin
if instr(p_deptname,'&')>0 then
Result :=testdeptstr(substr(p_deptname,0,instr(p_deptname,'&')-1)||'_'||substr(p_deptname,instr(p_deptname,'&')+1,length(p_deptname)));
else
Result := p_deptname;
end if;
return(Result);
end testdeptstr;
解决方案 »
- 咨询下not in 的问题
- 创建表的问题.急,急,急!!!!!
- oracle 跨库查询
- 大家推荐一本orcale初级书啊!
- 菜鸟求助:为何使用自定义函数之后查询效率变的非常低?
- 一个简单的函数,不知道为什么不能运行,难道声明不可以放到函数里面吗?
- 求一触发器、存储过程写法,由SQL的转ORACLE的触发器。。。急。。。。
- 记录分解
- 谁能把pcscfg.cfg文件发给我看看?
- oracle 存储过程 Error: PLS-00103: 出现符号 "GETALLPAYMENTAPPLY"在需要下列之一时: if
- 我找oracle软件,谁有下载。
- ORACLE数据库支持并发用户的数量与硬件配置的关系?
a2:=substr(v,instr(v,'#')+1,instr(v,'#',1,2)-1);
a3:=substr(v,instr(v,'#',1,2)+1,instr(v,'#',1,3)-1);
a4:=substr(v,instr(v,'#',1,3)+1,length(v));
v varchar2(50):='AS#123#789#000';
num number:=1;
type t_inx is table of varchar2(10) index by binary_integer;
v_inx t_inx;
begin
for i in 1..10 loop
exit when instr(v,'#')=0;
if i=1 then
v_inx(i):=substr(v,1,instr(v,'#')-1);
elsif instr(v,'#',1,i)>0 then
v_inx(i):=substr(v,instr(v,'#',1,i-1)+1,instr(v,'#',1,i)-1);
else
v_inx(i):=substr(v,instr(v,'#',1,i-1)+1,length(v));
end if;
end loop;
dbms_output.put_line(....);
end;
/