insert into select执行时间很长
我在pl/sql developer里面执行
INSERT INTO PRODUCTION(OPERATIONID,STARTDATE,ENDDATE,PRODUCTIONQUANTITY,UNITOFMEASURECODE,DEACTIVATE,IMPORTID,SOURCEID,LASTMODIFIEDDATE,USER01NUMBER,USER02NUMBER,USER03NUMBER,USER01FIELD,USER02FIELD,USER03FIELD)
(SELECT OPERATION.OPERATIONID, V_PRODUCTION .STARTDATE, V_PRODUCTION .ENDDATE, V_PRODUCTION .PRODUCTIONQUANTITY, V_PRODUCTION .UNITOFMEASURECODE, V_PRODUCTION .DEACTIVATE, V_PRODUCTION .IMPORTID, V_PRODUCTION .SOURCEID, V_PRODUCTION .RUNDATE, V_PRODUCTION .USER01NUMBER, V_PRODUCTION .USER02NUMBER, V_PRODUCTION .USER03NUMBER, V_PRODUCTION .USER01FIELD, V_PRODUCTION.USER02FIELD, V_PRODUCTION .USER03FIELD
FROM V_PRODUCTION
inner join OPERATION on OPERATION.operationcode = V_PRODUCTION .OperationCode
);
commit;
V_PRODUCTION 是一个视图,问题是这条语句执行了好长时间都不结束,select语句单独执行是成功的,而且就7条数据这是为什么?本人刚刚从sqlserver转过来,不是特别清楚啊,谢谢
------解决方案--------------------
如果7条数据是比较迅速的,检查锁.
------解决方案--------------------试试
create table PRODUCTION_test
(SELECT OPERATION.OPERATIONID, V_PRODUCTION .STARTDATE, V_PRODUCTION .ENDDATE, V_PRODUCTION .PRODUCTIONQUANTITY, V_PRODUCTION .UNITOFMEASURECODE, V_PRODUCTION .DEACTIVATE, V_PRODUCTION .IMPORTID, V_PRODUCTION .SOURCEID, V_PRODUCTION .RUNDATE, V_PRODUCTION .USER01NUMBER, V_PRODUCTION .USER02NUMBER, V_PRODUCTION .USER03NUMBER, V_PRODUCTION .USER01FIELD, V_PRODUCTION.USER02FIELD, V_PRODUCTION .USER03FIELD
FROM V_PRODUCTION
inner join OPERATION on OPERATION.operationcode = V_PRODUCTION .OperationCode
);