Question
I want to do a TEST procedure called VGR_TestUpdatedPnone for this procedure (triggers sql) UpdatedPnone VRG_ procedure DELIMITER $$ DROP PROCEDURE IF EXISTS VRG_UpdatePhone$$ CREATE
I want to do a TEST procedure called VGR_TestUpdatedPnone for this procedure (triggers sql)
UpdatedPnone
VRG_ procedure
DELIMITER $$
DROP PROCEDURE IF EXISTS VRG_UpdatePhone$$
CREATE PROCEDURE VRG_UpdatePhone( IN nCustName CHAR(25), IN priorAreaCode CHAR(3), IN priorPhoneNumber CHAR(8), IN newAreaCode CHAR(3), IN newPhoneNumber CHAR(8), OUT error_msg CHAR(80) )
BEGIN
DECLARE rowCount INT DEFAULT 0; DECLARE readCustomerID INT; DECLARE done INT DEFAULT 0; DECLARE Custcount, CIndex INT DEFAULT 0; DECLARE CustUpdate_Cursor CURSOR FOR SELECT CustomerID FROM VRG_CUSTOMER C WHERE C.CustName = nCustName AND C.areaCode = priorAreaCode AND C.phoneNumber = priorPhoneNumber; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SELECT COUNT(*) INTO rowCount FROM VRG_CUSTOMER C WHERE C.CustName = nCustName AND C.areaCode = priorAreaCode AND C.phoneNumber = priorPhoneNumber;
IF rowCount = 0 THEN SET error_msg = 'Customer Does Not Exist In Database -- No Action Taken'; ELSE OPEN CustUpdate_Cursor;
SET Custcount = (SELECT FOUND_ROWS()); WHILE Cindex CLOSE CustUpdate_Cursor; END IF; END$$ DELIMITER ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started