0
SET @session = '1'; SET @session = '[@session]';
SELECT @session;

This should print -: [1] but it is printing [@session];

Whats the problem? Thanks for help..

1 Answer 1

1

The result is as expected. [@session] was the last value that was set to variable @session.

SET @session = '1';           -- <<== first value
SET @session = '[@session]';  -- <<== second value (overrides the first value)
SELECT @session;

i think you mean,

SET @session = '1';           
SET @session = CONCAT('[', @session, ']');  
SELECT @session;
Sign up to request clarification or add additional context in comments.

1 Comment

But i want [1]. How to get this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.