Hi Seb.
When SQL Blocks did not make it into Genero I ended up writing a DSQL extension to our precompiler to make it easier for our developers to generate their Dynamic SQL without introducing runtime errors (missing spaces,quotes etc). I did a find across one part of our sourcecode and found this has been used around 1500 times to date. From the looks of it the majority of uses are to make the Dynamic SQL easier to read/maintain, i.e.
{$DSQL query_txt}
SELECT note_unique_key,
user_key,
date_updated
FROM note
WHERE note_unique_key BETWEEN 0 AND &MAX_INTEGER&
AND parent_type = {@'p_type'}
AND parent_ukey = {@p_key}
ORDER BY note_unique_key
{$DSQL}
Produces at compile time:-
LET query_txt = ""
," SELECT note_unique_key,"
," user_key,"
," date_updated"
," FROM note"
," WHERE note_unique_key BETWEEN 0 AND 2147483647"
," AND parent_type = " , ASCII 39,p_type CLIPPED, ASCII 39
," AND parent_ukey = " ,p_key CLIPPED
," ORDER BY note_unique_key"
Adding SFMT() to the language has improved things somewhat but using placeholders makes the code harder to read especially when you have several arguments. If dynamic SQL could somehow be written more naturally like static SQL then I think we would use a lot more of it.