Got error when creating procedure

49 views Asked by At

I want to get the info from table s via inputting specific student name.

Code goes like this:

delimiter //
    `CREATE PROCEDURE get_info_hujiamin (IN sn_input VARCHAR)  
BEGIN
    SELECT *
    FROM s
    WHERE s.sn=sn_input;
END`
 //
1

There are 1 answers

1
Rohit Sonaje On BEST ANSWER

Do query like below: here you haven't added length of VARCHAR

DELIMITER //
CREATE PROCEDURE GetOfficeByCountry(IN countryName VARCHAR(255))
 BEGIN
 SELECT * 
 FROM offices
 WHERE country = countryName;
 END //
DELIMITER ;

You can also refer My SQL Procedure