Thats kind of tough because it is dynamically created.
Testing you code is one way to make sure that the query built will always be correct. Catching the Exceptions will also work, or have you tried using the dynamic query package in Oracle, dbms_sql.
Question at AskTom that might help:
First. or do a search at AskTom, there are lots of them in his archives.
Mark