關鍵字 INSERT INTO...SELECT
INSERT INTO abc_file
(
a --要塞入的欄位
)
SELECT a1 --重點在裡面做變化
FROM abc_file
因為你給的需求太模糊 我只能給你個方向
好人做到底。其它要自己想囉!
DECLARE
CURSOR c1
IS
SELECT a1, a2, a3
FROM table_a
WHERE a1 = xxx;
BEGIN
FOR i IN c1
LOOP
IF i.a1 = 'A'
THEN
UPDATE tabe_b
SET b1 = i.a1, b2 = i.a2, b3 = i.a3
WHERE xxx;
END IF;
END LOOP;
END;