我的要求有点不同。我有两个嵌套的 FOR 循环来获取数据并根据特定条件将排序的数据插入表中。
原代码如下:
FOR Name_1 IN First_Cursor
LOOP
FOR Name_2 IN Second_Cursor (Name_1.Table_Field_Name)
LOOP
IF (Condition)
THEN
Prevalidation of data
INSERT INTO <Table_Name>
VALUES (..............................);
ELSE
IF (Condition)
THEN
Prevalidation of data
UPDATE <Table_Name>
WHERE .....................;
END IF;
END IF;
END LOOP;
END LOOP;
我必须将整个代码转换为 FORALL
我尝试了很多代码,但都成功了,我认为语法本身是错误的
IF (Condition)
THEN
Prevalidation of data
FORALL Name_2 IN Second_Cursor (Name_1.Table_Field_Name) of Name_1
INSERT INTO <Table_Name>
VALUES (..............................);
ELSE
IF (Condition)
THEN
Prevalidation of data
FORALL Name_2 IN Second_Cursor (Name_1.Table_Field_Name) of Name_1
UPDATE <Table_Name>
WHERE .....................;
END IF;
END IF;