Subject | Data Type Unknown |
---|---|
Author | mspencewasunavailable |
Post date | 2006-09-11T20:25:32Z |
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
STATEMENT:
TIBOInternalDataset: "<TApplication>.<TIBOQuery>.<TIBOInternalDataset
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" = ? /* servID */
and a1."Acc ID" = m.ID)
So I tried specifying the parameters like this:
ParamByName('dys').AsInteger := StrToInt(s);
ParamByName('dys').ParamType := ptInput;
ParamByName('dys').DataType := ftInteger;
ParamByName('servID').AsInteger := sid;
but it made no difference. If I remove :dys and plug in a constant
value (say, 10), everything works. ISTM that since :dys is a
literal, then server can't determine the type, so I also tried using
CAST(:dys as integer) instead of just :dys. This didn't work either.
I can clearly work around the issue by just generating the SQL
appropriately, but is there a way to parameterize a literal like
this?
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
STATEMENT:
TIBOInternalDataset: "<TApplication>.<TIBOQuery>.<TIBOInternalDataset
>." stHandle=39163476 (ERROR)and saw this SQL in the exeception's ShowDialog box:
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" = ? /* servID */
and a1."Acc ID" = m.ID)
So I tried specifying the parameters like this:
ParamByName('dys').AsInteger := StrToInt(s);
ParamByName('dys').ParamType := ptInput;
ParamByName('dys').DataType := ftInteger;
ParamByName('servID').AsInteger := sid;
but it made no difference. If I remove :dys and plug in a constant
value (say, 10), everything works. ISTM that since :dys is a
literal, then server can't determine the type, so I also tried using
CAST(:dys as integer) instead of just :dys. This didn't work either.
I can clearly work around the issue by just generating the SQL
appropriately, but is there a way to parameterize a literal like
this?