-- 按照给定的字节长度截取最大可能的中英文混合字符串,避免了半个汉字的问题
create or replace function substr_gb
(str_ varchar2,
begin_ integer,
length_ integer) return varchar2 is
result varchar2(256);
begin
if length(substrb(str_, begin_, length_)) =
length(substrb(str_, begin_, length_ + 1))
then
result := substrb(str_, begin_, length_ - 1);
else
result := substrb(str_, begin_, length_);
end if;
return result;
end substr_gb;