Give it a try on SQLBuilder tool
SQLBuilder is a flexible and powerful SQL query string builder for InterSystems IRIS,
With SQLBuilder you have nice and clean object oriented methods, instead of having to use concatenation and substituition to generate dynamic queries.
A Dynamic SQL without SQLBuilder
A Dynamic SQL with SQLBuilder
If you like it, don't forget to vote in the IRIS Programming Contest