Subject Re: [IBO] Data Type Unknown
Author Dany M
mspencewasunavailable wrote:
> Here is a TIBOQuery:
>
> UPDATE MSCHED m SET m."Next Date" = (SELECT Max(a."Date") + :dys
> FROM ARTRANS a where a."Code" <> 11
> and a."Code" <> 9
> and a."Serv ID" = ? /* servID */
> and a."Acc ID" = m.ID
> Group by a."Acc ID")
> WHERE EXISTS(SELECT a1."Acc ID" FROM ARTRANS a1 where a1."Code"
> <> 11
> and a1."Code" <> 9
> and a1."Serv ID" = :sid
> and a1."Acc ID" = m.ID)
>
> After I add it to the SQL object, I then set the parameters:
>
> ParamByName('dys').AsInteger := StrToInt(s);
> ParamByName('servID').AsInteger := sid;
>
> which works without complaint.
>
> When I ExecSQL, I get this error:
>
> ISC ERROR CODE:335544569
>
> ISC ERROR MESSAGE:
> Dynamic SQL Error
> SQL error code = -804
> Data type unknown
>

This is really an FB question. But try something along theese lines

SELECT MAX(A.DATE) + CASE WHEN (1=1) THEN :APARAM ELSE 3 END

i expect there are other (maybe better) ways but the case seems to work
in telling FB what type to expect.

HTH,

/Dany