Search notes:

Oracle PL/SQL package TXT: function GREP_RE_PIPELINED

Examples

Semicolon separated values

select
   column_value val
from
   txt.grep_re_pipelined('foo;bar;baz', '[^;]+');
-- VAL                                                                             
-- ---
-- foo
-- bar
-- baz

Turn a clob into text lines

The following example demonstrates how txt.grep_re_pipelined can be used to select the lines from a clob that contains a multi-line text.
Create a table with a clob column:
create table tq84_test_large_clob(id integer, txt clob);
Fill in a clob that is larger than 32K:
declare
   c clob;
begin
   dbms_lob.createtemporary(c, false);
   for i in 1 .. 10 loop
       dbms_lob.append(c, to_char(i, 'fm9999') || ': ' || lpad('.', 5000, '.') || case when mod(i,2) = 0 then chr(13) end || chr(10));
   end loop;
   insert into tq84_test_large_clob values (1, c);
end;
/
Use txt.grep_re_pipelined to turn the clob into lines:
select
   line.column_value
from
   tq84_test_large_clob lc,
   table(txt.grep_re_pipelined(lc.txt, '[^' || chr(10) || chr(13) || ']+')) line
where
   lc.id = 1
;
drop table tq84_test_large_clob;

See also

Oracle: PL/SQL package TXT for string (text) related functionality

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758200623, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/PL-SQL/libs/personal/txt/grep_re/pipelined/index(88): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78