Execute Stored Procedures - Oracle to MySQL Migration

In Oracle, you can execute a stored procedure from another stored procedure just specifying its name and parameters. In MySQL, you have to use the CALL statement.

Oracle:

  -- Sample procedure with parameters 
  CREATE OR REPLACE PROCEDURE sp1(param1 VARCHAR2, param2 VARCHAR2)
  IS
     var1 VARCHAR2(60);
  BEGIN
    var1 := param1 || ', ' || param2 || '!';
  END;
  /
 
  -- Sample procedure without parameters 
  CREATE OR REPLACE PROCEDURE sp2
  IS
     var1 VARCHAR2(60);
  BEGIN
    var1 := 'Hello, world!';
  END;
  /
 
  -- Executing procedures from another procedure
  CREATE OR REPLACE PROCEDURE sp3
  IS
  BEGIN
    sp1('Hello', 'world');
 
    -- You can call the procedure without parameters without or with ()
    sp2();
    sp2;
  END;
  /

MySQL:

  DROP PROCEDURE IF EXISTS sp3;
 
  DELIMITER //
 
  -- Executing procedures from another procedure
  CREATE PROCEDURE sp3()
  BEGIN
    CALL sp1('Hello', 'world');
 
    -- You can call the procedure without parameters without or with (), but CALL is required
    CALL sp2();
    CALL sp2;
  END;
  //
 
  DELIMITER ;

Note that the CALL keyword was added before the procedure name in MySQL.

For more information, see Oracle to MySQL Migration.