MySQL Forums
Forum List  »  Stored Procedures

Re: If Then Else is not working
Posted by: Peter Brawley
Date: June 19, 2021 09:09PM

Read the manual chapters on sprocs again, and notice the bits about begin & end, and the bits about defining a delimiter ...

drop procedure if exists sptest();
delimiter go
create procedure sptest()
begin
  IF (1=1) THEN
    select 1;
  ELSE
    select 2;
  END IF;
end;
go
delimiter ;
call sptest();
+---+
| 1 |
+---+
| 1 |
+---+

Options: ReplyQuote


Subject
Views
Written By
Posted
5849
June 19, 2021 08:02PM
Re: If Then Else is not working
1240
June 19, 2021 09:09PM


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.