2

Can you not do the following w/ MySQL stored procedures?/

DROP PROCEDURE IF EXISTS `test`;
DELIMITER //

CREATE PROCEDURE TEST (team varchar(30))
BEGIN
    SELECT * FROM TEAMS WHERE TEAM_ID = @team;
END
//

Where @team (or team) is the variable passed to the stored procedure?

1 Answer 1

8

You need to use:

DROP PROCEDURE IF EXISTS `test`;
DELIMITER //

CREATE PROCEDURE TEST (IN_TEAM_ID varchar(30))
BEGIN

    SELECT t.* 
      FROM TEAMS t
     WHERE t.team_id = IN_TEAM_ID;

END //

DELIMITER ;

There's no @ notation when referencing stored procedure parameters.

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

1 Comment

+1 for pro formatting and expert indentation. i'd write code with you any day.

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.