DECLARE
N_INS_Q_SUM NUMBER(13);
N_013_MENGE NUMBER(13);
CURSOR CR_MM017 IS
SELECT
MM017.MANDT
, MM017.INVNR
, MM017.INVITEM
, MM017.EBELN
, MM017.EBELP
FROM TABLE001 MM017
WHERE 1=1
AND MM017.MANDT = #G_MANDT#
AND MM017.INVNR = #INVNR#
AND MM017.LIFNR = #LIFNR#
BEGIN
FOR I_ROW IN CR_MM017 LOOP
SELECT MENGE
INTO N_013_MENGE
FROM TABLE002
WHERE MANDT = #G_MANDT#
AND EBELN = I_ROW.EBELN
AND EBELP = I_ROW.EBELP;
SELECT SUM(INS_Q) AS INS_Q
INTO N_INS_Q_SUM
FROM TABLE001
WHERE MANDT = #G_MANDT#
AND EBELN = I_ROW.EBELN
AND EBELP = I_ROW.EBELP;
IF N_013_MENGE = N_INS_Q_SUM THEN
UPDATE TABLE002
SET PO_STATE_BEF = (SELECT PO_STATE FROM ZMMT013 WHERE MANDT = #G_MANDT# AND EBELN = I_ROW.EBELN AND EBELP = I_ROW.EBELP)
, PO_STATE = '91'
WHERE MANDT = #G_MANDT#
AND EBELN = I_ROW.EBELN
AND EBELP = I_ROW.EBELP;
END IF;
END LOOP;
END;
'프로그래밍 > Oracle' 카테고리의 다른 글
[TOAD]oracle Function 생성시 Warning: compiled but with compilation errors (0) | 2013.07.11 |
---|---|
[FSP]한달통계(1-15, 16-31, 1-31) SUM (0) | 2013.07.11 |
[PL/SQL] 기본문법 (0) | 2013.07.05 |
TABLE CREATE[sample] (0) | 2013.06.17 |
(C#.NET)ora-01704 clob 에러(데이터 길이 에러) (0) | 2012.12.04 |