Subject | Slightly surprised by IBO |
---|---|
Author | Svein Erling Tysvær |
Post date | 2011-09-13T09:26:07Z |
In a TIB_Query, I did something like
SELECT *
FROM OneTable
WHERE MyField = :MyField
UNION
SELECT *
FROM AnotherTable
WHERE MyField = :MyField
MyTibQuery.ParamByName('MyField').AsString:='IBO';
Only results from AnotherTable appeared in the result set. Copying the query to IB_SQL, I discovered why - it expected two parameters! I then discovered that I had (erroneously) defined MyField as CHAR in OneTable, and as VARCHAR in AnotherTable. So I just changed the definition for one of the fields and everything worked as expected.
Is this behaviour as intended? If so, then fine, just a small gotcha for me to remember whenever I try to 'reuse' a parameter. I guess that two different parameters with identical names also means that the first parameter only can be accessed through Params and not ParamByName?
Set
[Non-text portions of this message have been removed]
SELECT *
FROM OneTable
WHERE MyField = :MyField
UNION
SELECT *
FROM AnotherTable
WHERE MyField = :MyField
MyTibQuery.ParamByName('MyField').AsString:='IBO';
Only results from AnotherTable appeared in the result set. Copying the query to IB_SQL, I discovered why - it expected two parameters! I then discovered that I had (erroneously) defined MyField as CHAR in OneTable, and as VARCHAR in AnotherTable. So I just changed the definition for one of the fields and everything worked as expected.
Is this behaviour as intended? If so, then fine, just a small gotcha for me to remember whenever I try to 'reuse' a parameter. I guess that two different parameters with identical names also means that the first parameter only can be accessed through Params and not ParamByName?
Set
[Non-text portions of this message have been removed]