0

How to use procedure overriding in MySql? Eg.

    CREATE DEFINER=`root`@`localhost` PROCEDURE `new_procedure`(IN FieldName varchar(30))
BEGIN
    SET @query = 'StackOverflow';
    SELECT @query;
END

When i should call new_procedure("Test") this should be executed. Along with this if i call new_procedure() this should be executed and should give the output as "StackOverflow" in both the calling.

  • have you used 'Drop procedure if exist name ' in your procedure name – Ankit Agrawal Jun 15 '17 at 08:00
  • What you're asking for is `optional parameter`. MySQL doesn't support it. However, work around is there : https://stackoverflow.com/questions/12652241/writing-optional-parameters-within-stored-procedures-in-mysql?noredirect=1 – Prabhat G Jun 15 '17 at 08:22

0 Answers0