declare
object_name varchar2(24);
type ref_cursor_type is ref cursor;
cursor_object ref_cursor_type;
begin
open cursor_object for
'
select regexp_substr(''3h,4c,5e,6b,7a,8g'', ''[^,]+'', 1, level) a
from dual
connect by level <= regexp_count(''3h,4c,5e,6b,7a,8g'', '','') + 1
';
loop
begin
fetch cursor_object into object_name;
exit when cursor_object%notFound;
if object_name = '4c' then
dbms_output.put_line('good:'||object_name);
end if;
end;
end loop;
end;
本文通过一段SQL代码展示了如何使用变量和正则表达式进行复杂查询,具体包括定义变量、使用ref_cursor_type和执行SQL语句获取特定字符。

4489

被折叠的 条评论
为什么被折叠?



