OK, using exec_statement as suggested. Tested and works fine.