title: Replace pair of % in oracle
body: <p>please, I have in Oracle table this texts (as 2 records)</p>
  
  <p><code>
  "Sample text with replace parameter %1%"
  "You reached 90% of your limit"
  </code></p>
  
  <p>I need replace %1% with specific text from input parameter in Oracle Function. In fact, I can have more than just one replace parameters. I have also record with <code>"Replace this %12% with real value"</code></p>
  
  <p>This functionality I have programmed:</p>
  
  <pre><code>IF poc &gt; 0 THEN
    FOR i in 1 .. poc LOOP
      p     := get_param(mString =&gt; mbody);
        mbody := replace(mbody,
        '%' || p || '%', parameters(to_number(p, '99')));
    END LOOP;
  END IF;
  </code></pre>
  
  <p>But in this case I have problem with text number 2. This functionality trying replace "90%" also and I then I get this error:</p>
  
  <p><code>ORA-06502: PL/SQL: numeric or value error: NULL index table key value</code></p>
  
  <p>It's a possible to avoid try replace "90%"? Many thanks for advice.</p>
  
  <p>Best regards</p>
  
  <p>PS: Oracle version: 10g (OCI Version: 10.2)</p>