DB2 LUW 9.X:存储过程中的多行插入

DB2 LUW 9.X: Multirow insert in stored procedures

从存储过程向 table 插入多行的最佳性能方式是什么?

EXEC SQL
  INSERT INTO DSN8A10.ACT 
    (ACTNO, ACTKWD, ACTDESC)
    VALUES (:HVA1, :HVA2, :HVA3)
    FOR :NUM-ROWS ROWS
END-EXEC.

以上显然只在 z/os 中可用,而在 luw 中不可用。有没有等价物?

"DB2 9.x" 的规范有点太宽泛了。从 DB2 9.7 开始,您可能会使用 UNNEST() table function,像这样:

insert into ACT (ACTNO, ACTKWD, ACTDESC) 
select ACTNO, ACTKWD, ACTDESC from unnest (V_ARR) as (ACTNO, ACTKWD, ACTDESC);

假设 V_ARR 是行类型数组 "columns" ACTNOACTKWDACTDESC.