Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't assign local variables to user variables #8911

Open
jycor opened this issue Mar 1, 2025 · 0 comments
Open

can't assign local variables to user variables #8911

jycor opened this issue Mar 1, 2025 · 0 comments
Labels
bug Something isn't working correctness_approved

Comments

@jycor
Copy link
Contributor

jycor commented Mar 1, 2025

When you have a stored procedure declared like this:

create procedure proc()
begin
  declare v int default 123;
  set @v = v;
end;

Dolt:

tmp2/main*> select @v;
+------+
| @v   |
+------+
| NULL |
+------+
1 row in set (0.00 sec)

tmp2/main*> call proc();
+
|
+
|
+
1 row in set (0.00 sec)

tmp2/main*> select @v;
+------+
| @v   |
+------+
| NULL |
+------+
1 row in set (0.00 sec)

MySQL:

mysql> select @v;
+------+
| @v   |
+------+
| NULL |
+------+
1 row in set (0.0004 sec)

mysql> call proc();
Query OK, 0 rows affected (0.0007 sec)

tmp2/main*> select @v;
+-----+
| @v  |
+-----+
| 123 |
+-----+
1 row in set (0.0004 sec)
@jycor jycor added bug Something isn't working correctness_approved labels Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness_approved
Projects
None yet
Development

No branches or pull requests

1 participant