如果你想,你必須foreach循環內進行一些處理SELECT INTO變量。所以,你的代碼將變成:
drop procedure if exists _this_is_it ;
drop table if exists this_table ;
create temp table this_table(column1 CHAR(3), column2 CHAR(4), column3 CHAR(3))
with no log ;
insert into this_table values("A","B","C") ;
create procedure _this_is_it(this CHAR(3), that CHAR(4), other CHAR(3))
returns CHAR(10) AS something
define f_this CHAR(3) ;
define f_that CHAR(4) ;
define f_other CHAR(3) ;
foreach
select * into f_this, f_that, f_other
from this_table
where column1 = this and
column2 = that and
column3 = other
return f_this||f_that||f_other WITH RESUME ;
end foreach
end procedure;
grant execute on _this_is_it to public;
execute procedure _this_is_it("A","B","C") ;
drop procedure if exists _this_is_it ;
drop table if exists this_table ;
的語法foreach語句可從IBM在其Infocenter。
嘗試將'foreach'更改爲'for' – Bohemian
同樣處理語法錯誤 – user867621