|
[code=sql]INSERT INTO SFISM4.R_REEL_TRACKING_T A SELECT B.*
FROM SFISM4.R_REEL_ORIGINAL_T B
WHERE B.STORE_NO = 'KB101157'
AND B.REEL_ID NOT IN
(SELECT E.REEL_ID
FROM SFISM4.R_REEL_TRACKING_T E
WHERE E.REEL_ID IN (SELECT C.REEL_ID
FROM SFISM4.R_REEL_ORIGINAL_T C
WHERE C.STORE_NO ='KB101157'));[/code]
[code=sql]
INSERT INTO SFISM4.R_REEL_EXCHANGE_LOG_T
SELECT B.REEL_ID,B.SUB_AREA,B.WORKING_AREA,SYSDATE,'物料发料','123'
FROM SFISM4.R_REEL_ORIGINAL_T B
WHERE B.STORE_NO ='KB101157'
AND B.REEL_ID NOT IN
(SELECT E.REEL_ID
FROM SFISM4.R_REEL_TRACKING_T E
WHERE E.REEL_ID IN (SELECT C.REEL_ID
FROM SFISM4.R_REEL_ORIGINAL_T C
WHERE C.STORE_NO ='KB101157'))[/code]
第一条可以执行,这是一个串表找到数据行为,SQL 可以使用其他方式写,无非就是去除掉一部分的子查询。然后 插入到日志中。 插入正常,然后插入日志异常,怀疑为Oracle
锁表,最后没办法,取值循环插入日志。 这里想问下关于锁表相关知识。
|
|