Hi David,
You mean certainly dynamic SQL not Dynamic 4gl ;-)
Googling around it appears that there is no real standard for SQL optimizer hints.
Informix has:
{+ ... }
/*+ ... */
--+ ...
Oracle supports:
/*+ ... */
--+ ...
MySQL includes the hints in the syntax (not as special comments):
SELECT * FROM table1 USE INDEX (col1_index,col2_index)
WHERE col1=1 AND col2=2 AND col3=3;
So if you write such SQL, it will not be portable, and if you want to achieve SQL portability, you will have to use dynamic SQL anyway...
We could support /*+ ... */ style comments, but this is not as easy as it looks like because we have to change several syntax parsers to support this properly. Filed as enhancement #24367... low priority.
Regarding a new built-in function to enabled/disable SQL debug output, this is easy to do, filed as enhancement #19214, certainly without risk, will see if it can be done for 2.50.
Cheers