1

I am a bit confused with mysql create procedure script. My script looks like as follows:

DELIMITER //
DROP PROCEDURE play;
CREATE PROCEDURE play()
BEGIN
insert into hi (name,id)VALUES ('apple','2010');
END
//

It does not insert into table hi.

3
  • You need to explain a little more than that. Is this script not working, or does it not insert when you call the PROCEDURE, do you get an error? Commented Apr 9, 2010 at 3:18
  • I figure out how to insert now. I do not use "create procedure". It can work. Now My problem how to use procedure to do? Commented Apr 9, 2010 at 3:20
  • 1
    It seems that you are under the impression that the above script (by itself) would insert values. The above script only creates the procedure, you need to call the procedure afterwards, to execute it. Commented Apr 9, 2010 at 3:24

2 Answers 2

1

Your script does not actually execute the play procedure via call command

You need to add

call play

command

Sign up to request clarification or add additional context in comments.

Comments

0

use

CALL play();

and I suggest use

DROP PROCEDURE IF EXISTS play()  

instead DROP PROCEDURE play()

1 Comment

What does it adds to the previously accepted answer? Why you recommend the IF EXISTS play()? Comments will be useful for others looking for an answer to have a better understanding of your code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.