Seeking silence!

I just want to assign a variable from a query that returns a single value
result.
The problem is that the following will also emit (print) the result to the
terminal as a side effect.

SELECT [at] SomeVar := SomeFieldCalculation
FROM ...
WHERE ...

Is there not a simple way to accomplish this silently. IOW - get SELECT to
shut up since it is merely assigning a variable for use further along. Or
is there some other assignment syntax I should use that doesn't involve the
verbose SELECT.

And yes - I do know I can redirect the output to oblivion.

I just think I must be missing something ;-)
Thomas Bartkus
Thomas Bartkus [ Do, 22 Juni 2006 16:17 ] [ ID #1365824 ]

Re: Seeking silence!

It's a bit of a hack, but you can do this:

set [at] somevar := ( select randomtext from random_table where ... );

Thomas Bartkus wrote:
> I just want to assign a variable from a query that returns a single value
> result.
> The problem is that the following will also emit (print) the result to the
> terminal as a side effect.
>
> SELECT [at] SomeVar := SomeFieldCalculation
> FROM ...
> WHERE ...
>
> Is there not a simple way to accomplish this silently. IOW - get SELECT to
> shut up since it is merely assigning a variable for use further along. Or
> is there some other assignment syntax I should use that doesn't involve the
> verbose SELECT.
>
> And yes - I do know I can redirect the output to oblivion.
>
> I just think I must be missing something ;-)
> Thomas Bartkus
raisinodd [ Mo, 26 Juni 2006 21:34 ] [ ID #1370528 ]
Datenbanken » mailing.database.mysql » Seeking silence!

Vorheriges Thema: how to import Excel file into an already normalized database?
Nächstes Thema: Searching in Boolean mode with double quotes far too slow