Subject Param Value lost within query
Author tomjanczkadao
Hi
I've statement which uses twice one parameter:

with qTest do begin
SQL.Text := 'insert into NEW_TABLE ('
+ ' ID,'
+ ' MY_DATE,'
+ ' MY_FOREIGN_KEY)'
+ ' select'
+ ' gen_id(gen_test, 1),'
+ ' :date_param,'
+ ' (select first 1 t.id from foreign_table t'
+ ' where t.year = extractyear(:date_param))'
+ ' from rdb$database';

ParamByName('date_param').AsDate := Date();
ExecSQL;
end;

and this query inserts <null> into MY_DATE field!
SQL_MONITOR:
PARAMS = [ Version 1 SQLd 2 SQLn 2
[DATE_PARAM] = <NULL> < SQLType: 571 SQLLen: 4 Addr: 24109038 > !!!
[DATE_PARAM] = '24 lut 2012' ]

qTest is a TIB_Query, IBO 4.9.14.32

regards, Tomek