-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddLowItems.sql
More file actions
27 lines (21 loc) · 854 Bytes
/
addLowItems.sql
File metadata and controls
27 lines (21 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
CREATE DEFINER=`root`@`localhost` PROCEDURE `addLowItems`()
BEGIN
DECLARE finished INTEGER DEFAULT 0;
DECLARE currentlocation varchar(100) DEFAULT "";
DECLARE transID INTEGER DEFAULT 0;
DECLARE curLocations
CURSOR FOR
SELECT locationID FROM bullseye.location WHERE locationTypeID = "Store";
DECLARE CONTINUE HANDLER
FOR NOT FOUND SET finished = 1;
OPEN curlocations;
getLocations: LOOP
FETCH curLocations INTO currentlocation;
IF finished = 1 THEN
LEAVE getLocations;
END IF;
SELECT transactionID INTO transID FROM bullseye.transaction WHERE originalLocationID = currentlocation AND transactionStatus = "NEW" AND transactionType = "ORDER";
CALL addLowItems2(currentlocation, transID);
END LOOP getLocations;
CLOSE curLocations;
END