如果您的源表和目标表符合此配置文件:
- 目标表的列与源表的列相同,并且
- 新的目标列位于末尾
...然后你可以做这样的事情:
INSERT INTO dest_table
SELECT Source_Table.*, new_value
FROM Source_Table
WHERE Source_Table.PKValue = cursor.PKValue
如果这是您的光标类似于目标表的情况,则类似这样的方法可能有效,但请注意我尚未对其进行测试:
CREATE PROCEDURE whatever IS
destRow dest_table%ROWTYPE;
CURSOR fromSourceTable IS
SELECT <your existing select list>, NULL AS new_value
FROM <the rest of your cursor query>;
BEGIN
FOR destRow IN fromSourceTable LOOP
destRow.new_value = <the split date>;
INSERT INTO dest_table VALUES destRow;
END LOOP;
END whatever;
我要带着NULL AS new_value
. 如果您遇到问题,请尝试CAST(NULL AS DATE) AS new_value
改用,如果您仍然遇到问题,请尝试类似SYSDATE AS new_value
. 同样,这没有经过测试,但如果您认为它很有希望并且难以实施,我很乐意对其进行测试。