首先是写一个分割字符串的函数,返回table类型
create or replace function fn_split (p_str in varchar2, p_delimiter in varchar2) return ty_str_split is j int := 0; i int := 1; len int := 0; len1 int := 0; str varchar2 (4000); str_split ty_str_split := ty_str_split (); begin len := length (p_str); len1 := length (p_delimiter); while j < len loop j := instr (p_str, p_delimiter, i); if j = 0 then j := len; str := substr (p_str, i); str_split.extend; str_split (str_split.count) := str; if i >= len then exit; end if; else str := substr (p_str, i, j - i); i := j + len1; str_split.extend; str_split (str_split.count) := str; end if; end loop; return str_split; end fn_split;
上面这个函数可以将字符串分割返回table
create or replace function fn_ispng( strpng in varchar2 ) return number is v_num number; begin with t1 as (select * from table (fn_split(strpng,'.')) ) select count(1) into v_num from t1 where t1.column_value in ('png', 'jpg','jpeg','gif','bmp','eps'); return v_num; end fn_ispng;
上面这个是判断是否是图片格式,的图片格式返回1
select fn_ispng('dfdfd.png') from dual;
以上所述是www.887551.com给大家介绍的oracle 函数判断字符串是否包含图片格式,希望对大家有所帮助