MySQL Forums
Forum List  »  Newbie

Re: IF ELSE
Posted by: Michael Smith
Date: March 22, 2023 07:21PM

Barry:

OK, I have changed the code somewhat as below:

DELIMITER //
drop procedure IF EXISTS CountIN ;
create procedure CountIN (@cnt INT) ;

BEGIN
SELECT COUNT(ITEM) INTO @cnt FROM Invoices01 WHERE invnbr > 0 ;
IF @cnt = 0 THEN SELECT @mnewnumber := Nextra5 from Storage01 ;
update Invoices01 set invnbr = @mnewnumber ;
END IF ;
END //

DELIMITER ;

I am now getting 2 error messages:
1) The code won't stop
2) The commands are out of sync.

Any ideas?

Options: ReplyQuote


Subject
Written By
Posted
March 15, 2023 03:31PM
March 19, 2023 12:56AM
March 22, 2023 01:34PM
March 22, 2023 05:02PM
Re: IF ELSE
March 22, 2023 07:21PM
March 23, 2023 01:54AM
March 26, 2023 06:24PM


Sorry, you can't reply to this topic. It has been closed.

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.