create or replace type type_table is table of varchar2(100);
create or replace function returnLanguage
(
s_language varchar2
)
return table_strs
is
table_strs type_table;
begin
--最多出现俩国语言
if instr(s_language, ',', 1, 2) > 0 then
dbms_output.put_line('抛出异常');
--如果存在俩国语言
elsif instr(s_language, ',',1,1) > 0 then
table_strs(0) := substr(s_language, 0, instr(s_language, ',',1,1) - 1);
table_strs(1) := substr(s_language, instr(s_language, ',',1,1) + 1, length(s_language));
dbms_output.put_line(table_strs(0));
dbms_output.put_line(table_strs(1));
--如果只存在一国语言
elsif instr(s_language, ',',1,1) = 0 then
table_strs(0) := s_language;
dbms_output.put_line(table_strs(0));
end if;
end;
Oracle 截取字符串函数 返回表类型
最新推荐文章于 2024-01-31 09:05:26 发布