johnnal
johnnal

Reputation: 47

Error on assign char_length to variable

The following statement works fine:

select char_length(nomoi_queue) from proroute where startNomosPro='low';

But when i try to assign char_length to a variable:

set @var = char_length(nomoi_queue) from proroute where startNomosPro='low';
select @var;

i get no results. What is going wrong;

Upvotes: 1

Views: 76

Answers (1)

Rahul Tripathi
Rahul Tripathi

Reputation: 172378

This is not a proper syntax to assign value to a variable. Try like this:

set @var = (select char_length(nomoi_queue) from proroute where startNomosPro='low');

or try like this:

select char_length(nomoi_queue) into @var from proroute where startNomosPro='low';

Upvotes: 1

Related Questions