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 :
So I try to call it explicitly from the code:
What's the best/correct way to do this ? Thanks !
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
in this case an integer variable defined in the report variables. But I can replace it by its value like 1, it doesn't propagate to de :id in the request, that's the problem.