create or replace function f_change_zhiwu(p_string IN VARCHAR2,p_delimiter IN VARCHAR2)return varchar2 isResult varchar2 as n_length NUMBER := 0; v_tmpstr VARCHAR2(1000);n_tmpnum NUMBER := 0;beginn_length := LENGTH(p_string);for i in 0 .. n_length loopv_tmpstr := substr(p_string, i, i + 1);if v_tmpstr = p_delimiter thenResult := Result || substr(p_string, n_tmpnum, i) || '-';n_tmpnum := n_tmpnum + i + 1;end if;end loop;return(Result);end f_change_zhiwu;在第五行报如下错误,如何解决:PLS-00103: 出现符号 "AS"在需要下列之一时::= . ( @ % ; not null rangedefault character
2 回答
呼唤远方
TA贡献1856条经验 获得超11个赞
1. Result varchar2 后加分号
2. 去掉as
如下:
create or replace function f_change_zhiwu(p_string IN VARCHAR2,
p_delimiter IN VARCHAR2)
return varchar2 is
Result varchar2;
n_length NUMBER := 0;
v_tmpstr VARCHAR2(1000);
n_tmpnum NUMBER := 0;
begin
n_length := LENGTH(p_string);
for i in 0 .. n_length loop
v_tmpstr := substr(p_string, i, i + 1);
if v_tmpstr = p_delimiter then
Result := Result || substr(p_string, n_tmpnum, i) || '-';
n_tmpnum := n_tmpnum + i + 1;
end if;
end loop;
return(Result);
end f_change_zhiwu;
- 2 回答
- 0 关注
- 1132 浏览
添加回答
举报
0/150
提交
取消