sql temp table creation with parameter

since several request in my report use the same subquery, I wrote a DBXQuery that prepares a temporary table :
CREATE TEMP TABLE temp AS SELECT * FROM arealtable WHERE id = :id -- more complex in reality...
First I linked it to a dummy MasterData band, but it complains the request doesn't return a Cursor (why is this a problem ? it returns no data so the band should imho simply be empty...)
So I try to call it explicitly from the code:
qCreateTemp.Params.ParamByName('id').Value := <id>;
qCreateTemp.ExecSQL;
but I get an error "Could not convert a variant of type (Null) into type (Integer)"
What's the best/correct way to do this ? Thanks !

Comments

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.