Created
May 2, 2024 21:51
-
-
Save ChrisMoney/d7a926532796037e0609cc85b469da21 to your computer and use it in GitHub Desktop.
Cursor - Created SQL Objects in memory with properties to read from later in query
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, | |
ACTIVE_FLG, | |
CREATE_ID, | |
CREATE_DATE, | |
UPDATE_ID, | |
UPDATE_DATE) | |
VALUES (s.STORE, | |
m.MENU_ID, | |
'Y', | |
'SYSTEM', | |
SYSDATE, | |
'SYSTEM', | |
SYSDATE); | |
--DBMS_OUTPUT.PUT_LINE('ENDLOOP:'); | |
END LOOP; | |
END LOOP; | |
-- Handle Attributes | |
-- Store 162 | |
UPDATE IMPROD.SM_SYS_MENU_STORES | |
SET ACTIVE_FLG = 'N' | |
WHERE STORE = 162 | |
AND MENU_ID NOT IN | |
( | |
8, -- Merchandising | |
12, -- Priority List | |
13, -- Product Removed | |
14, -- Reports | |
18, -- Store Tags | |
25, -- Function Log | |
26, -- Priority List (Report) | |
195 -- License Plate Tag | |
); | |
-- WHSE Special Orders | |
UPDATE IMPROD.SM_SYS_MENU_STORES | |
SET ACTIVE_FLG = 'N' | |
WHERE STORE = 582 | |
AND MENU_ID NOT IN | |
( | |
8 | |
); | |
COMMIT; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment