Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

Why is UDP needed? Why cant a user program directly access IP?

Answered: 1 week ago