Home > database >  Using % ROWTYPE replace Cursor as Procedure into the refs
Using % ROWTYPE replace Cursor as Procedure into the refs

Time:04-22

- CREATED ON 2021/4/21
DECLARE
- LOCAL VARIABLES HERE
I the INTEGER;
CURSOR C_CUR IS
SELECT * FROM PO_LT_REPORT_ALL;

TYPE ALL_MAR_LIST IS TABLE OF C_CUR % ROWTYPE INDEX BY BINARY_INTEGER;
AML_S ALL_MAR_LIST;

PROCEDURE INSERT_DATE (AML_S IN ALL_MAR_LIST) - define a child function
IS
The BEGIN
FOR I IN 1.. AML_S. COUNT LOOP
INSERT INTO PO_LT_REPORT_ALL (MITAC_PN, ITEM_DESC) VALUES (AML_S (I). MITAC_PN, AML_S (I). The ITEM_DESC);
END LOOP;
COMMIT;
END INSERT_DATE;


The BEGIN

- the TEST STATEMENTS HERE
- FOR C1 C_CUR IN LOOP

- get all the data
The OPEN C_CUR;
The FETCH C_CUR BULK COLLECT INTO AML_S;
The CLOSE C_CUR;

INSERT_DATE (AML_S);
- END LOOP;

END;
  • Related