PROCEDURE in mysql

this is the first time i write. this is the example that i am use it but i have error  

CREATE PROCEDURE `kfupm`.`procedure1` ()
BEGIN
  select fname, lname, count(horseid) horses
  from Owner, Owns
  where Owner.ownerId = Owns.ownerId
  group by Owns.ownerId
  having count(horseId) > 2

END

how can i solve the error ?
mohannad399Asked:
Who is Participating?
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
try:

DELIMITER // [1]
CREATE PROCEDURE `mysql`.`simpleproc4` (OUT param1 INT)
BEGIN
  select fname, lname, count(horseid) horses
  from Owner, Owns
  where Owner.ownerId = Owns.ownerId
  group by Owns.ownerId
  having count(horseId) > 2;
END
0
 
mankowitzConnect With a Mentor Commented:
DELIMITER $$

DROP PROCEDURE IF EXISTS `kfupm`.`procedure1` $$
CREATE PROCEDURE `kfupm`.`procedure1` ()
BEGIN
  select fname, lname, count(horseid) horses
  from Owner, Owns
  where Owner.ownerId = Owns.ownerId
  group by Owns.ownerId
  having count(horseid) > 2;
END $$

DELIMITER ;
0
 
Meir RivkinFull stack Software EngineerCommented:
change the mysql`.`simpleproc4 to your db and procedure name
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.