How does one check if a select statement inside a stored procedure returns any rows.
select * from creditcards;
If sqlcod = 0 THEN
I'd like to do something like this for example but sqlcod doesn't seem to work in MySql.
try using COUNT
,
DELIMITER $$
CREATE PROCEDURE procName()
BEGIN
SET @recCount = (select count(*) from creditcards);
If @recCount = 0 THEN
-- statement here ;
END IF;
END $$
DELIMITER ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With