我已经在oracle中编写了一个脚本,以将现有字段的值捕获到变量中,然后将该值用于insert语句。我收到错误提示,在此代码行不能将保留关键字用作标识符
SELECT INTO act_id8 FROM INSIGHT.INSIGHT_MVC_ACTION where name like 'ResearchPanel';
脚本
declare
act_id8 number;
begin
SELECT INTO act_id8 FROM INSIGHT.INSIGHT_MVC_ACTION where name like 'ResearchPanel';
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6012,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6000,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6001,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6002,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6003,act_id8,15);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6004,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6005,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6006,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6015,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(1005,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(1006,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6011,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6079,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6080,act_id8,15);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(1004,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6041,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(1007,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6007,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6025,act_id8,5);
INSERT INTO INSIGHT.INSIGHT_MVC_ROLE_ACTION(ROLE_ID,ACTION_ID,PERMISSION_ID) VALUES(6016,act_id8,5);
commit;
end
答案 0 :(得分:0)
您忘记了包含要选择的字段的名称。你写了
SELECT INTO act_id8 FROM INSIGHT.INSIGHT_MVC_ACTION where name like 'ResearchPanel';
您应该写类似
SELECT some_field INTO act_id8 FROM INSIGHT.INSIGHT_MVC_ACTION where name like 'ResearchPanel';
用您要检索的INSIGHT_MVC_ACTION中的字段名称替换some_field
,您应该会很好。
好运。