Dynamisches SQL mit Ergebnis geht nur mit Cursor!

sqlstmt = 'select Count(*) from ' + MyFile;
exec SQL prepare MyStmt from : sqlstmt;
exec SQL declare MyCursor Cursor for MyStmt;
exec SQL open MyCursor;
exec SQL fetch MyCursor into : Count;
exec SQL Close myCursor;

Dies beschreibt nur das Prinzip, die genaue Syntax entnimm bitte dem Handbuch.