Error in Uni SQL with insert select statement and empty string parameter
Posted: Sat 10 Sep 2016 14:00
Hello, I have observed the next problem using Unidac 6.4.14 with ORACLE. The same with FIREBIRD runs fine.
I have the next statement
It seems the problem is with an string parameter value empty
I have the next statement
Code: Select all
insert into TableA( FIELD1, FIELD2, FIELD3, FIELD4, FIELD5 )
select FIELD1, FIELD2, :PARAMSTR1, :PARAMINT2, :PARAMDATE3
from TableB
where PKTABLEB = 1
PARAMSTR1, is an string parameter
PARAMINT2 is an integer parameter
PARAMDATE3 is a Datetime parameter
If I run the query with the next values, no record is inserted
ParamByName( 'PARAMSTR1' ).Value := '' <- empty string
ParamByName( 'PARAMINT2' ).value := 1
ParamByName( 'PARAMDATE3' ).Value := now
If I run the query with the next values, record is inserted
ParamByName( 'PARAMSTR1' ).Value := ' ' <- Now there is an space
ParamByName( 'PARAMINT2' ).value := 1
ParamByName( 'PARAMDATE3' ).Value := now
If I run the query with the next values, record is inserted
ParamByName( 'PARAMSTR1' ).Value := 'x'
ParamByName( 'PARAMINT2' ).value := 1
ParamByName( 'PARAMDATE3' ).Value := now
If I change the query and remove the string parameter, allways run fine
insert into TableA( FIELD1, FIELD2, FIELD4, FIELD5 )
select FIELD1, FIELD2, :PARAMINT2, :PARAMDATE3
from TableB
where PKTABLEB = 1
ParamByName( 'PARAMINT2' ).value := 1
ParamByName( 'PARAMDATE3' ).Value := now