Subject 'IN' problem
Author Nick Upson
I'm trying to use a list of ids to exclude in a select called from C.
To try and make it easier to explain this SP shows the same problem. I
provide a list of id's in a varchar, but 1 & 2 both ignore the IN,
only the 3rd gives the answer I'm looking for.

How can I get the same answer?

CREATE OR ALTER PROCEDURE AA_TEST (str Varchar(40))
returns (rcount2 Integer,
rcount1 Integer,
rcount3 Integer)
AS

begin

str = '1, 2, 3';

SELECT count(*) FROM TBLTXAPPMSGQ WHERE BASEIDENT NOT IN ( '1, 2, 3' )
into :rcount1;

SELECT count(*) FROM TBLTXAPPMSGQ WHERE BASEIDENT NOT IN ( :str ) into :rcount2;

SELECT count(*) FROM TBLTXAPPMSGQ WHERE BASEIDENT NOT IN ( 1, 2, 3 )
into :rcount3;
end