将数据从 table 插入/复制到相同的值 PL-SQL

insert into / copy data from table to same with some changing value PL-SQL

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;

有人知道为什么它不起作用

您可以 select 行并将它们插入到同一个 table 中,并进行如下更改:

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

你不需要 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