title: pl/sql - Using a dynamic query inside a stored procedure
body: <p>I am using a stored procedure to insert data into a temp table using a cursor.
  This procedure stores a dynamic query inside a variable to mount the insert/update command.</p>
  
  <p>Here is the code(not the full query, I've cut some parts to make it easier to read):</p>
  
  <pre><code> FOR VC2 IN (SELECT C.OBJETIVO,
                  C.AUDITORIA ,
                  C.NOME, 
                  C.PRODUTO
             FROM CALCULO C)
    LOOP
  
    SELECT  ' V_UPD NUMBER := 0;
  
                SELECT (SELECT ID_TIPO_TERR  
                FROM ZREPORTYTD_TMP 
               WHERE AUDITORIA = ''' || VC2.AUDITORIA || '''
                  AND TERRITORIO = ''' || VC2.NOME  || '''
                  AND PRODUTO = ''' || VC2.PRODUTO || ''') 
                 INTO V_UPD FROM DUAL;
  
                    UPDATE ZReportYTD_TMP
                       SET  TARGET = ' || VC2.OBJETIVO  || '
                     WHERE AUDITORIA = ''' || VC2.AUDITORIA || '''
                       AND TERRITORIO = ''' || VC2.NOME  || '''
                       AND PRODUTO = ''' || VC2.PRODUTO || ''';'
  
                 INTO V_SQL  FROM DUAL;
  
                 EXECUTE IMMEDIATE (V_SQL);
  
    END LOOP
  </code></pre>
  
  <p>Inside the dynamic query, in this part <code>"SET  TARGET = ' || VC2.OBJETIVO  || '"</code> the value <code>VC2.OBJETIVO</code> is a <code>Number</code> type, and it's replaced like "62481,76". In other words, this comma is making the command wrong and doesn't work.</p>
  
  <p>Is there an easy way to replace the "," for "."?</p>
  
  <p>Thank you very much! (:</p>