Search notes:

Test for function REPLACE_ENTIRE_WORDS of PL/SQL package TXT

This is a test case for the function replace_entire_words of the PL/SQL package txt.
declare

   procedure cmp(text varchar2, word varchar2, replacement varchar2, expected varchar2) is -- {
       gotten varchar2(4000);
   begin

       gotten := txt.replace_entire_words(text, word, replacement);
       if gotten != expected then
          dbms_output.put_line('replace_entire_words: ' || gotten || ' != ' || expected);
       end if;

   end cmp; -- }

begin
   cmp('foo,bar,baz', 'foo', 'xxx', 'xxx,bar,baz');
   cmp('foo,bar,baz', 'bar', 'xxx', 'foo,xxx,baz');
   cmp('foo,bar,baz', 'baz', 'xxx', 'foo,bar,xxx');
   cmp('foo,bar,baz', 'FOO', 'xxx', 'xxx,bar,baz');
   cmp('foo,bar,baz', 'BAR', 'xxx', 'foo,xxx,baz');
   cmp('foo,bar,baz', 'BAZ', 'xxx', 'foo,bar,xxx');
   cmp('foo,bar,baz', 'oo' , 'xxx', 'foo,bar,baz');
end;
/
Github repository PL-SQL-pkg-txt, path: /_test/replace_entire_words.sql

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...', 1758206545, '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/_test/replace_entire_words(58): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78