1

I am trying to create a stored procedure and testing some basic concepts.

For the last few hours, I am getting errors with this procedure, in terms of syntax. This is in MySQL (MariaDB).

use fifteens
DELIMITER //
 CREATE PROCEDURE TestProcedure() (INOUT :startDate, :count)
   BEGIN
DECLARE x INT default 0; 
REPEAT
 SELECT DATE_ADD(startDate, INTERVAL 1 DAY)
   SET x = x + 1; 
        UNTIL x  = count;
        END REPEAT;
END//
DELIMITER ;

Any help in resolving this would help me get to the next level :)

  • Server will never use the syntax you invented. Remove colons from argument list. Add semicolon to SELECT and remove from UNTIL. – Akina Oct 4 '18 at 4:51
  • Remove the (). RTFM – Rick James Oct 15 '18 at 21:09
  • I figured the errors here. The ':' are not correct for sql, my reference source was wrong. Besides this, there were many others errors, as i have learnt to write it correctly. I will post the better way to do this soon – rohan Nov 3 '18 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.