title: Plsql best way to split string
body: <p>What is the best way to extract words from a string?
  I already made something up because I found many ways and none of them looked 'simple'.</p>
  
  <p>Let's assume there is a procedure called 'change_opening_hours'. This procedure has a time-range string input called 'v_perioden'.</p>
  
  <p>This string looks like:</p>
  
  <p>'10:00-12:00' <strong>OR</strong> </p>
  
  <p>'10:00-12:00 14:00-16:00' <strong>OR</strong> </p>
  
  <p>'10:00-12:00 14:00-16:00 18:00-22:00' <strong>etc</strong></p>
  
  <p>Now I already made something up myself to exstract every period of time from this input.</p>
  
  <pre><code>  v_perioden   VARCHAR2(50) := '10:00-12:00 14:00-18:00 22:00-24:00';
    ...
    -- loop though time-periode depeningd
    -- on amount of spaces
    FOR i IN 0..REGEXP_COUNT(v_perioden, ' ') LOOP
      -- first period
      IF i = 0 THEN DBMS_OUTPUT.PUT_LINE(SUBSTR(v_perioden, 0, 11));
      -- second period
      ELSIF i = 1 THEN DBMS_OUTPUT.PUT_LINE(SUBSTR(v_perioden, 13, 11));
      --thirt period
      ELSIF i = 2 THEN DBMS_OUTPUT.PUT_LINE(SUBSTR(v_perioden, 25, 11));
      END IF;
    END LOOP;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>10:00-12:00
  14:00-18:00
  22:00-24:00
  </code></pre>
  
  <p>Now this way is working fine, but it isn't that capable. I tried to find out how to extract words from a string on a space but this wasn't working out tho.</p>