GBase 8c
其他
文章

GBase 8c BULK COLLECT INTO子句

发表于2023-12-06 16:06:2220次浏览0个评论

将存储过程内语句返回的值存储到变量内,BULK COLLECT INTO允许将部分或全部返回值暂存到数组内部。

示例:

gbase=# DECLARE

    my_id integer;

BEGIN

    select id into my_id from customers limit 1; -- 赋值

END;

/

gbase=# DECLARE

    type id_list is varray(6) of customers.id%type;

    id_arr id_list;

BEGIN

    select id bulk collect into id_arr from customers order by id DESC limit 20; -- 批量赋值

END;

评论

登录后才可以发表评论