There is an a problem on declaring variables on MYSQL stored procedure.The code I used I used is shown below.

DELIMITER $$

CREATE
    /*[DEFINER = { user | CURRENT_USER }]*/
    PROCEDURE `emp`.`third_SP`()
    /*LANGUAGE SQL
    | [NOT] DETERMINISTIC
    | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
    | SQL SECURITY { DEFINER | INVOKER }
    | COMMENT 'string'*/
    BEGIN
DECLARE p1 int ;



   SELECT Min(esal)
   INTO pl
   FROM employ;
 



    END$$


DELIMITER ;

It shows the error message as
----------------------------------
error code :1327
undeclared variable p1
----------------------------------
I am using MySQL 5.1.4.1..Using SQLYOG Enterprise Trial 7. 11 as GUI.Anyone plz help me.

Thanks

If your editor supports different fonts, then change your font-family to Verdana.

Otherwise copy and paste your code onto a text editor (like MS Word); highlight it all then change the font-family to Verdana.

Do you see the now that p1 (p followed by number one) is NOT the same as pl (p followed by lowercase "L")!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.