HELP:SQL statement fails

Here's my SQL statement from a TQuery that fails:

insert into my_1st_table  (field1,field2,filed3)
select :myvar , sum(field4) ,count(field5)  from my_2nd_table
where field1= :myvar

All fields are integer, also myvar which has been assigned a value
prior to executing the sql

The error I get is : General SQL ERROR,  datatype unknown
Trying to cast all fields, and myvar as integer does not change

Substituting the myvar with a constant makes the query work fine, but
I really would like to use a variable here..