Subject SP problem execute statement
Author Jack Mills

firebird 2.5 on windows XP

I have a SP that compiles ok & debugs ok using IBExpert but when I try to run the sp I get error 'Output parameters mismatch'

Here the relevant statements.
select c.Test_ID_New, c.ta_check from ptst p
left outer join tst_cfgd c on p.test_code = c.Test_Code and p.m1 = c.m1 and p.m2 = c.m2 and p.m3 = c.m3
where p.uop_no = :uop and p.state_no = :state and p.test_no = :test
into :id, :sel_query;

sel_query = replace (sel_query, 'where p.uop_no =','where p.uop_no = '||:uop||' and p.state_no = '||:state||' and p.test_no = '||:test||'');

execute statement sel_query into :ta1,:ta2,:ta3,:ta4,:ta5,:ta6,:ta7,:ta8,:ta9,:ta10,:ta11,:ta12,:ta13,:ta14,:ta15,:ta16,:ta17,:ta18,:ta19,:ta20,:ta21,:ta22,:ta23,:ta24,:ta25,:ta26;

The reported problem line is
execute statement sel_query into :ta1 etc.

ta1 through ta26 are declared as local varchar variables.

Typical contents of sel_query
select distinct p.tag1, p.oper, p.tag2, p.tag3,
case when (p.tag1 = a1.tag_no) then 'ok' else 'bad' end as at1,
case when (p.oper = o.code) then 'ok' else 'bad' end as op,
case when (p.tag2 = a2.tag_no) then 'ok' else 'bad' end as at2,
case when (p.tag3 = a3.tag_no) then 'ok' else 'bad' end as at3,
'nu' as at9,'nu' as at10,'nu' as at11,'nu' as at12,'nu' as at13,'nu' as at14,'nu' as at15,'nu' as at16,'nu' as at17,'nu' as at18,'nu' as at19,'nu' as at20,'nu' as at21, 'nu' as at22,'nu' as at23,'nu' as at24, 'nu' as at25, 'nu' as at26
from ptst p
left outer join analog a1 on p.tag1 = a1.tag_no
left outer join opers o on p.oper = o.code
left outer join analog a2 on p.tag2 = a2.tag_no
left outer join analog a3 on p.tag3 = a3.tag_no
where p.uop_no =

I tried changing at1~at26 to output parameters but that changed the problem line to the one following the execute statement into etc., but I don't think there is a problem with the line.

During debugging with IBExpert all the selected sel_query are correct & all the contents of at1~at26 appear correct.
Any help appreciated.
I can post the full sp if it would make thing clearer.