title: replace or remove characters and then cast to decimal
body: <p>I need to remove or replace an unwanted haracter <code>(%)</code> wich is in the end of a string and thyen to cast the string to a decimal, because I need to get the <strong>sum</strong> of 2 fields named <code>discount1</code> and <code>discount2</code></p>
  
  <p>The last combination I tried is:</p>
  
  <pre><code>replace ((p16.pa_value,'%','')CAST (p16.pa_value AS DECIMAL (3,0))) as discount2,
  </code></pre>
  
  <p>It seems to be super wrong as the <code>CAST</code> is inside of the <code>replace</code> statement</p>