You will see this error normally when the SQL statement in the SP are not terminated with semicolon. Can you share the table ddl alongwith the SP definition to have a look as what could be missing.
There is no reason as why the CASE statements won't work in the SP. I have just tested a scenario and it works fine for me...
drop procedure sp;
drop table tbl_test0;
drop table tbl_test1;
create multiset table tbl_test0(a integer, b integer) primary index(a);
create multiset table tbl_test1(a integer, b varchar(10)) primary index(b);
insert into tbl_test0(1,-1);
insert into tbl_test0(2,1);
insert into tbl_test0(3,2);
REPLACEPROCEDURE trm6211cust.SP()
L1: BEGIN
INSERTINTO tbl_test1(a,b)
select a, case when b>=0 then 'true' else 'false' end as b from tbl_test0
;
END;
call sp();
select * from tbl_test1;
The output is fine and is as expected...
1 false
2 true
3 true
↧