--
-- ### Select where in with expression list  
--

drop if exists table t1;
create table t1 ( a int, b string(30));
drop if exists table t2;
create table t2 ( c int, d string(30));


insert into t1 values ( 1, 'XXX');
insert into t1 values ( 2, 'XXX');
insert into t1 values ( 3, 'XXX');
insert into t1 values ( 8, 'XXX');
insert into t1 values ( 9, 'XXX');

insert into t2 values ( 9, 'X');


select * from t1 where a in ( 1, 2, ( select c from t2 where d = 'X') );


drop if exists procedure checkQueryInProc;

@
create procedure checkQueryInProc(x in string(10)) return int
begin
   var a int;
   :a = ( select a from t1 where a in ( 99, 98 , ( select c from t2 where d = :x ) ) );
   return :a;
end;
@

:i = call checkQueryInProc('X');
-- should be 9 
print :i;

drop procedure checkQueryInProc;

