René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -

use of SUBSTR and INSTR

The following example shows how to use SUBSTR and INSTR to extract strings of variable length. The table ALL_SOURCE is queried in order to find all system defined exceptions.
  (text,                                 -- text of which substr is to be taken
     instr(                              -- beginning of substring
        text,                            -- find 'EXCEPTION_INIT' within text and add length
     instr(                              -- length of substr
       text,                             -- search text
         ',',                            -- find a ','
         instr(text, 'EXCEPTION_INIT(')  -- after the length calculated as
         +  LENGTH ('EXCEPTION_INIT('))  -- above
       -                                 -- and substract
         (instr(text, 'EXCEPTION_INIT(') -- the end position of
   ) "Exceptions"
from all_source where name = 'STANDARD' and type = 'PACKAGE' and text like '%EXCEPTION%'