ORA-06502: PL/SQL: 数字或值错误 : 字符串缓冲区太小

oracle错误 ORA-06502: PL/SQL: 数字或值错误 : 字符串缓冲区太小,

判断字符串是否都为数字:

create or replace function IsNumber(Name in varchar2) return boolean is

  Result boolean;

  sz varchar2(10);

  pos integer;

  zf varchar2(1); --接收 中文或全角符号时, 长度超过接收变量。

  cd integer;

  begin

sz:='0123456789';

Result:=true;

pos:=1;

cd:=length(name);

zf:=substr(name,pos,1);

while pos <= cd loop

if instr(sz,zf,1)!=0 then

pos:=pos+1;

zf:=substr(name,pos,1);

else

Result:=false;

return(Result);

end if;

end loop;

 return(Result);

end IsNumber;

--查询出哪些数据是含有 中文或全角符号的。 占3个字节。

SELECT a.aac147,a.* FROM icd1 a where length(a.aac147)<>lengthb(a.aac147);

猜你喜欢

转载自yhzhangdota.iteye.com/blog/2378582