4D v11 SQL provides the ability to build dynamic SQL queries via the EXECUTE IMMEDIATE command. For example, you might want to execute the same SELECT statement on more than one table. In "pure" SQL this would need to be written as two different statements:
|Begin SQL |
SELECT * FROM Table_1 INTO :mylistbox
SELECT * FROM Table_2 INTO :mylistbox
This can be made dynamic by using EXECUTE IMMEDIATE:
$SQL:="SELECT * FROM "+$tableName+" INTO :mylistbox"
EXECUTE IMMEDIATE :$SQL
With this technique you are not limited to only executing static SQL statements.