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

Make multiple user variable assignment work similar in standalone query and in SP

    XMLWordPrintable

    Details

      Description

      I run this script:

      SET @a=10;
      SET @a=20,@b=@a;
      SELECT @a,@b;
      

      +------+------+
      | @a   | @b   |
      +------+------+
      |   20 |   10 |
      +------+------+
      

      No I wrap the same script into an anonymous SP block:

      DELIMITER $$
      BEGIN NOT ATOMIC
      SET @a=10;
      SET @a=20,@b=@a;
      SELECT @a,@b;
      END
      $$
      

      +------+------+
      | @a   | @b   |
      +------+------+
      |   20 |   20 |
      +------+------+
      

      Notice:

      • in the standalone script @b was assigned to the initial value of @a
      • in the anonymous block @b was assigned to the new value of @a

      We'll make multiple SET inside an SP work the same way with a standalone SET.

      Note, multiple SET for SP variables should also work the same way.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:

                  Git Integration