Created
February 17, 2024 15:07
-
-
Save ChrisMoney/c1fa71d350077036900c49c4cd20c0ae to your computer and use it in GitHub Desktop.
Cursor - Allows you to maintain a sql result in an object to iterate through
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Formatted on 2/1/2024 10:10:51 AM (QP5 v5.381) */ | |
DELETE FROM IMPROD.SM_SYS_MENU_STORES | |
WHERE 1 = 1; | |
DECLARE | |
CURSOR stores IS | |
SELECT STORE | |
FROM improd.store a | |
WHERE store_status = 0 | |
AND pos_close_Date IS NULL | |
AND store_type IS NULL | |
AND a.IP_SECOND_OCTET IS NOT NULL | |
UNION | |
SELECT STORE | |
FROM Improd.STORE A | |
WHERE A.store_status = 0 AND A.retail_store = 'Y' | |
UNION | |
SELECT warehouse_complex_id AS store FROM IMPROD.WAREHOUSE_COMPLEX; | |
CURSOR menuList IS SELECT MENU_ID FROM IMPROD.SM_SYS_MENU; | |
BEGIN | |
--DBMS_OUTPUT.PUT_LINE('BLOOP:'); | |
FOR s IN stores | |
LOOP | |
--DBMS_OUTPUT.PUT_LINE('CLOOP:'); | |
FOR m IN menuList | |
LOOP | |
INSERT INTO IMPROD.SM_SYS_MENU_STORES (STORE, | |
MENU_ID, | |
CREATE_ID, | |
CREATE_DATE, | |
UPDATE_ID, | |
UPDATE_DATE) | |
VALUES (s.STORE, | |
m.MENU_ID, | |
'SYSTEM', | |
SYSDATE, | |
'SYSTEM', | |
SYSDATE); | |
--DBMS_OUTPUT.PUT_LINE('ENDLOOP:'); | |
END LOOP; | |
END LOOP; | |
COMMIT; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment