MySQL variable is NULL after it was set
up vote
0
down vote
favorite
I set a variable in MySQL and in the next SELECT query it is NULL.
SET @test = 123;
SELECT @test;
When executing the SET statement, there is no error.
Do I have to enable/activate the usage of variables?
I run MySQL Server 4.1.
mysql variables
add a comment |
up vote
0
down vote
favorite
I set a variable in MySQL and in the next SELECT query it is NULL.
SET @test = 123;
SELECT @test;
When executing the SET statement, there is no error.
Do I have to enable/activate the usage of variables?
I run MySQL Server 4.1.
mysql variables
5
4.1 !! That is beyond ancient :O
– Madhur Bhaiya
2 days ago
Do you execute the statements from MySQL command line?.
– wchiquito
2 days ago
Are you selecting in the same session as setting the variable?
– fancyPants
2 days ago
1
DoesSELECT @test:=123work?
– Giorgos Myrianthous
2 days ago
Does setting a global variable work?SELECT @@test=123
– Mark
2 days ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I set a variable in MySQL and in the next SELECT query it is NULL.
SET @test = 123;
SELECT @test;
When executing the SET statement, there is no error.
Do I have to enable/activate the usage of variables?
I run MySQL Server 4.1.
mysql variables
I set a variable in MySQL and in the next SELECT query it is NULL.
SET @test = 123;
SELECT @test;
When executing the SET statement, there is no error.
Do I have to enable/activate the usage of variables?
I run MySQL Server 4.1.
mysql variables
mysql variables
edited 2 days ago
Giorgos Myrianthous
3,52621233
3,52621233
asked 2 days ago
Sven Richter
150513
150513
5
4.1 !! That is beyond ancient :O
– Madhur Bhaiya
2 days ago
Do you execute the statements from MySQL command line?.
– wchiquito
2 days ago
Are you selecting in the same session as setting the variable?
– fancyPants
2 days ago
1
DoesSELECT @test:=123work?
– Giorgos Myrianthous
2 days ago
Does setting a global variable work?SELECT @@test=123
– Mark
2 days ago
add a comment |
5
4.1 !! That is beyond ancient :O
– Madhur Bhaiya
2 days ago
Do you execute the statements from MySQL command line?.
– wchiquito
2 days ago
Are you selecting in the same session as setting the variable?
– fancyPants
2 days ago
1
DoesSELECT @test:=123work?
– Giorgos Myrianthous
2 days ago
Does setting a global variable work?SELECT @@test=123
– Mark
2 days ago
5
5
4.1 !! That is beyond ancient :O
– Madhur Bhaiya
2 days ago
4.1 !! That is beyond ancient :O
– Madhur Bhaiya
2 days ago
Do you execute the statements from MySQL command line?.
– wchiquito
2 days ago
Do you execute the statements from MySQL command line?.
– wchiquito
2 days ago
Are you selecting in the same session as setting the variable?
– fancyPants
2 days ago
Are you selecting in the same session as setting the variable?
– fancyPants
2 days ago
1
1
Does
SELECT @test:=123 work?– Giorgos Myrianthous
2 days ago
Does
SELECT @test:=123 work?– Giorgos Myrianthous
2 days ago
Does setting a global variable work?
SELECT @@test=123– Mark
2 days ago
Does setting a global variable work?
SELECT @@test=123– Mark
2 days ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53225229%2fmysql-variable-is-null-after-it-was-set%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
5
4.1 !! That is beyond ancient :O
– Madhur Bhaiya
2 days ago
Do you execute the statements from MySQL command line?.
– wchiquito
2 days ago
Are you selecting in the same session as setting the variable?
– fancyPants
2 days ago
1
Does
SELECT @test:=123work?– Giorgos Myrianthous
2 days ago
Does setting a global variable work?
SELECT @@test=123– Mark
2 days ago