0

这可以在“forall”中转换这个“for”吗?

FOR  tempCounter in tempCollection.FIRST .. tempCollection.LAST LOOP
  IF tempCollection(tempCounter).execactstockkey IS NULL THEN
    RETURN;
  END IF;
  INSERT INTO  tbexectempactstock VALUES  tempCollection(tempCounter);
END LOOP; 

我也试过这个

FORALL tempCounter in tempCollection.FIRST .. tempCollection.LAST
  INSERT WHEN tempCollection(i).execactstockkey IS NOT NULL
    THEN INTO tbexectempactstock VALUES tempCollection(tempCounter);

但它弹出我缺少 SELECT KEYBOARD

4

2 回答 2

2

我怀疑您是否可以将此条件语句转换为FORALL INSERT. AFORALL MERGE可能是可能的,但我认为最好的方法是在单个插入中完成:

INSERT INTO tbexectempactstock
SELECT * FROM TABLE(tempCollection)
 WHERE execactstockkey IS NOT NULL
于 2018-10-08T07:41:32.363 回答
0

您可以使用非空子句

   FORALL tempCounter  IN tempCollection.FIRST .. tempCollection.LAST
    INSERT INTO tbexectempactstock 
    SELECT
        *
    FROM TABLE(tempCollection(tempCounter))
    WHERE tempCollection(tempCounter).execactstockkey IS NOT NULL;
于 2018-10-08T07:54:42.580 回答