Mach das SQL-Statement dynamisch und fühere es mit EXECUTE immediate aus. Etwas in die Richtung:

Code:
D  MySQLStmt     S            1024A   Varying

 /Free
    MySQLStmt = 'Create Table QTEMP/MYTABLE +
                     as (Select ..... +
                           From ... +
                           Where     MyFld1 = '   + %Char(MyNumVar) +
                               ' and MyFld2 = ''' + MyCharVar + ''' +
                                 and ... ) +
                 With Data';

    Exec SQL Execute immediate :MySQLStmt;
 /End-Free
Birgitta