Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10862

Stored procedures: default values for parameters (optional parameters)

    XMLWordPrintable

    Details

      Description

      It would be nice if stored procedures supported parameters with default values. This way, if I need to modify a stored procedure to add more parameters to it, my old code with calls to the SP can continue to work. Also, this missing feature could be a blocker for migrations from other SQL DBMSes to MariaDB.

      To clarify, I would like to be able to do something like:

      DELIMITER //
      CREATE PROCEDURE sp(IN p1 INT DEFAULT 1) BEGIN SELECT p1; END //
      DELIMITER ;
       
      CALL sp();
      +------+
      | p1   |
      +------+
      |    1 |
      +------+
      1 row in set (0.00 sec)
      Query OK, 0 rows affected (0.00 sec)
      

      This feature exists e.g. in:

      Note that this is also a long-standing request for MySQL, and users continue to comment on the request to say how useful it would be, e.g. when converting from other DBMSes.

      [25 Dec 2005 6:22] Valerii Kravchuk

      Thank you for a useful feature request. By optional parameter you mean the one with default value, I believe... So, that the value for it can be ommited in the SP call. Oracle's PL/SQL also has this feature. I think it should be implemented as soon as possible to simplify migration from other RDBMS to MySQL 5.

      https://bugs.mysql.com/bug.php?id=15975

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              karll Karl Levik
              Votes:
              8 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated: