create or replace function func_upper(v_str in varchar2) return varchar2 as
v_char varchar2(200);
begin
v_char := '';
for i in 1 .. length(v_str) loop
if regexp_instr(substr(v_str, i, 1), '[A-Z]') = 0 then
v_char := v_char || substr(v_str, i, 1);
elsif regexp_instr(substr(v_str, i, 1), '[A-Z]') = 1 then
v_char := v_char || '_' || substr(v_str, i, 1);
end if;
end loop;
return v_char;
end;
複製代碼
select replace(to_char(wm_concat(case
when REGEXP_INSTR(data1, '[A-Z]') = 1 then
'_' || data1
else
data1
end)),
',',
'')
from (select substr('aBBbcDeF', level, 1) as data1
from dual
connect by level <= length('aBBcDeF'))
複製代碼