BEGIN
FOR i IN (select * from Mpl_Form_Responses t WHERE t.form_ID = 1944 and t.response_id > 15) LOOP
INSERT INTO Mpl_Form_Responses
(Form_Id, Response_Id,remarks, Userid)
VALUES
(7399, i.RESPONSE_ID,i.remarks, i.userid);
END LOOP;
END;
任何人都知道它为什么不起作用
答案 0 :(得分:2)
您可以选择行并将它们插入到同一个表中,其中一些更改如下:
INSERT INTO Mpl_Form_Responses(Form_Id, Response_Id,remarks + 'edited', Userid)
select 7399, t.Response_Id, t.remarks, t.Userid
from Mpl_Form_Responses t
WHERE t.form_ID = 1944
答案 1 :(得分:0)
你不需要PL / SQL:
INSERT INTO mpl_form_responses
(form_id
,response_id
,remarks
,userid)
SELECT 7399 as form_id
,response_id
,remarks
,userid
FROM mpl_form_responses t
WHERE t.form_id = 1944
AND t.response_id > 15