create or replace function aa1(a1 integer[],a2 bigint) returns void AS $$ declare ii integer; declare num integer; begin II:=1; num = 1; FOR ii IN 1..a2 LOOP UPDATE student SET id=a1[num] WHERE cd_id = ii; num = num +1; if (num>6) then num = 1; end if; end loop; end; $$ LANGUAGE plpgsql; select aa1(array[1,4,5,6,7,8],6742)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。