在PL/SQL中,可以使用以下方法批量導入數據:
INSERT INTO table2 (column1, column2, column3)
SELECT column1, column2, column3
FROM table1;
DECLARE
CURSOR cur_data IS
SELECT column1, column2, column3
FROM table1;
BEGIN
FOR rec_data IN cur_data LOOP
INSERT INTO table2 (column1, column2, column3)
VALUES (rec_data.column1, rec_data.column2, rec_data.column3);
END LOOP;
COMMIT;
END;
DECLARE
TYPE data_type IS TABLE OF table1%ROWTYPE;
data data_type;
BEGIN
SELECT column1, column2, column3
BULK COLLECT INTO data
FROM table1;
FORALL i IN 1..data.COUNT
INSERT INTO table2 (column1, column2, column3)
VALUES (data(i).column1, data(i).column2, data(i).column3);
COMMIT;
END;
以上是在PL/SQL中批量導入數據的幾種常見方法,可以根據具體需求選擇合適的方法進行操作。