Subject Re: How can I set the parameter type?
Author Eric Handbury
--- In IBObjects@y..., "Marco Menardi" <mmenaz@l...> wrote:
> I use IB_Query (4.2Ia, Firebird 1.01). Sometime I need something
like this:
> Select * from customers where customers.code=(substr(:P_CODE,1,2))
>
> Or add a where conditions like:
> ...
> and ((strlen(:P_CODE)=2) or (:P_CODE='AAAA'))
> ...
> But when I try this in the IB_Query editor, the error "data type
unknown" is generated (the same with QuickDesk SQL editor).
> How can I tell IB_Query the type of the parameters (i.e. char(6),
so that a substr() can work?

I haven't tried this, but could you cast it? say...

select * from customers where code = (substr(CAST(:P_CODE AS CHAR
(6)),1,2))