MySQL Forums
Forum List  »  Newbie

Re: Stored Procedure
Posted by: Michael Smith
Date: August 16, 2024 05:25AM

Barry:

I have found some sample code and have used it to make error free code with MySQL Workbench as below.

Unfortunately it does not work in the environment I am in called Retool.

I will have to go back to their Forum Group and see if they cvan helpme.

Thanks for your help.

Mike
************

DROP PROCEDURE IF EXISTS pbackup1 ;

USE ccprocess;

DELIMITER //

CREATE PROCEDURE pbackup1()
BEGIN

DECLARE mContinue TINYTEXT DEFAULT " ";
DECLARE count1 INT DEFAULT 1;
DECLARE CCNT1 INT DEFAULT 1;

set mContinue = "YES";

WHILE mContinue = "YES" DO

set CCNT1 := (SELECT COUNT(Check01) FROM Invoices02 WHERE EXTRA1 = " " );

IF CCNT1 > 0 THEN
set @mInvnbr := (SELECT Invnbr FROM Invoices02 WHERE Check01 = 1 and EXTRA1 = " ");

UPDATE Invoices02 SET EXTRA1 = 'X' WHERE Invnbr = @mInvnbr;
ELSE
SET mContinue = 'NO';
END IF;
END WHILE;

END //

DELIMITER ;

Options: ReplyQuote


Subject
Written By
Posted
August 13, 2024 12:21PM
August 13, 2024 08:04PM
August 14, 2024 12:07AM
August 14, 2024 07:13AM
August 14, 2024 09:44PM
August 15, 2024 07:47AM
August 15, 2024 03:58PM
August 15, 2024 06:32PM
August 15, 2024 06:36PM
Re: Stored Procedure
August 16, 2024 05:25AM
August 15, 2024 05:49PM
August 16, 2024 08:32AM
August 16, 2024 03:41PM
August 16, 2024 09:24PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.