title: MYSQL syntax for if with data stored in the database
body: <p>i want to create in mysql an event schedule every day that check 
  if the current date is greater than a date stored in the database table and then call some store procedures. </p>
  
  <p>Reading my WRONG mysql code you will understand that i want to do:</p>
  
  <pre><code>delimiter $
  set global event_scheduler = on$
  create event if not exists `end_qualifications`
      on schedule
      every day
      do
      begin
      if curdate() &gt;= (select `end_date` from `round` where `nome` = 
      "qualifications")
      then
      /* call myprocedure(params); */
      end if;     
      end $
  delimiter ;
  </code></pre>
  
  <p>I found here <a href="https://stackoverflow.com/questions/17520215/if-statement-in-the-mysql-stored-procedure-for-selecting-data">If-statement in the MySQL stored procedure for selecting data</a> something similar, but there is not way my code work as i want.</p>
  
  <p>I'm a beginner with mysql so it's possible that what i want to do can't be done.</p>
  
  <p>Anyone knows how to make my code work?</p>
  
  <p>I'm using MySQL client version: 5.7.25</p>
  
  <p>EDITED: this is the error i get when i try to run the query</p>
  
  <pre><code>ERROR 1064 (42000): You have an error in your SQL syntax; check the 
  manual that corresponds to your MariaDB server version for the right 
  syntax to use near 'do                                            
       begin
       if curdate() &gt;= (select `end_date` from `round` where `nome` = 
       "q' at line 5
  </code></pre>
  
  <p>I don't know if it matters, but the database is empty for now.</p>