# 循环 下面哪一项定义的函数可以生成指定范围内的整数数列? ## 答案 ```postgresql create function gen(start integer, stop integer) returns setof integer as $$ begin for idx in start .. stop loop return next idx; end loop; end; $$ language plpgsql; ``` ## 选项 ### A ```postgresql create function gen(start integer, stop integer) returns integer as $$ begin for idx in start .. stop loop return idx; end loop; end; $$ language plpgsql; ``` ### B ```postgresql create function gen(start integer, stop integer) returns integer as $$ begin for idx in start .. stop loop yield idx; end loop; end; $$ language plpgsql; ``` ### C ```postgresql create function gen(start integer, stop integer) returns setof integer as $$ begin for idx in start .. stop loop return idx; idx += 1; end loop; end; $$ language plpgsql; ``` ### D ```postgresql create function gen(start integer, stop integer) returns setof integer as $$ begin for idx in start .. stop loop select idx; end loop ; end; $$ language plpgsql; ```