This content has been marked as final. Show 3 replies
Wrong using dynamic SQL (there's nothing dynamic about it).
Wrong using literals and not bind variables.
Wrong using a ref cursor.
Wrong using an insert in a cursor fetch loop and not a single INSERT..SELECT cursor.
There's nothing right about this code.
I agree with Billy, this should be written as a single INSERT ... SELECT ... statement.
Also a useful programming technique is to use block indentation to display the structure of your code and make it easier to understand.