下面这个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;
解决方案 »
- 求高手解决.数据库运算
- 麻烦前辈们帮帮忙!谢谢
- greenplum数据库,请教一条SQL
- PLS-00103: Encountered the symbol "VARCHAR2" when expecting one of the
- Select语句中的表名[table]是否可以通过外部调用时输入,而不必在语句中指定?
- 基础:在sqlplus中如何查看有哪些序列?如何查看表分区的分区名?
- oracle有关表空间的小问题
- 请问BDE和ORACLE连接的问题,各位大虾,帮帮忙忙,急啊。。。。
- 怎样在ORACLE9i 的存储过程中使用动态表名
- 请教:如何用workbench连接Oracle11
- 我找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;
/