Balsher Singh Balsher Singh - 3 months ago 11
MySQL Question

This is suppose to be simple MySQL CREATE PROCEDURE something is very wrong

I am using a table named country from Database names world. Which has these two columns
Code char(3)

Name char(52)

I will keep on banging my head but as a beginner wanted to know if I am close to getting it right. Thanks.

USE world;

DELIMITER //

CREATE PROCEDURE ctbyc(IN a_c CHAR(3), OUT a_s CHAR(52))
BEGIN
SELECT `Name` INTO a_s FROM country WHERE `Code`=a_c
END//

Answer

semi-colon

DROP PROCEDURE IF EXISTS ctbyc;
DELIMITER //
CREATE PROCEDURE ctbyc
(   IN a_c CHAR(3), 
    OUT a_s CHAR(52)
)
BEGIN
    SELECT `Name` INTO a_s FROM country WHERE `Code`=a_c; -- missing semi-colon
END//
DELIMITER ;