What about simply doing this in your PL/SQL:
INSERT INTO results(SrcProcedure) VALUES (tabela_temporare(1).text);
Internally it will use bind variables to pass your PL/SQL variable into the INSERT.
Note that it is highly advised to stay away from dynamic SQL (EXECUTE IMMEDIATE
and the likes), because that code will be prone to SQL injection.
[UPDATE]
I don't know what more to tell. However consider these things for using a dynamically built SQL within a FOR
loop using string search and replace:
- It will be terribly slow, because for each loop iteration, you recompile the dynamic SQL.
- The SQL itself will execute slower because it cannot be cached.
- You have the danger of SQL injection that can lead to bugs and security issues. You think you fixed it by search and replace quotes, but I bet there might be scenario's you did not take into account.
- The process itself of search and replace for quotes is also terribly slow.
There are good uses of dynamic SQL, but that is just not one of them, and it is also against all possible advice to 'concatenate' parameters vs 'binding' them.