in reply to Parse and change an SQL statement

Will DBI Solve your problem?