return '0' means number
return '1' means others
create function is_number(val in varchar2) return varchar2
as
begin
if to_number(val)<>to_number(val)+1 then
return '0';
end if;
return '1';
exception
when others then
return '1';
end;
/
return '1' means others
create function is_number(val in varchar2) return varchar2
as
begin
if to_number(val)<>to_number(val)+1 then
return '0';
end if;
return '1';
exception
when others then
return '1';
end;
/
--収支年月判断(英数字)
-----------------------
FOR i IN 1..LENGTHB(jigyousyo) LOOP
IF SUBSTRB(jigyousyo, i, 1) NOT IN (
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
)
THEN
RAISE my_suji_error;
END IF;
END LOOP;
这样写,,可以吗??还有其他的优化办法吗??
return '0' means number 数字
return '1' means Upper letter 大写字母
return '2' means Lower Letter 小写字母
return '-1' means other 其他
=============================================================================*/create function Is_NumberAndLetter(val in char)
return number
is
begin
if (Ascii(val)>=48 and ascii(val)<=57) then
return '0';
end if; if (Ascii(val)>=65 and ascii(val)<=90) then
return '1';
end if; if (Ascii(val)>=97 and ascii(val)<=122) then
return '2';
end if;
return '-1';
exception
when others then
return '-1';
end Is_NumberAndLetter;
/