Assigning value of SQL output to a variable in shell scripting

I am trying to assgn the output of the select statement to a variable, like this

"VARIABLE_NAME=$ db2 "select COLUMN_NAME_1 from TABLE_NAME where COLUMN_NAME_2='VALUE_TO_CHECK'"; "

but the value that is getting into VARIABLE_NAME is

"COLUMN_NAME_1
-----------------
VALUE

1 record(s) selected"

I came to know by doing echo.

How to get only the VALUE in to the VARIABLE_NAME ??

Please help

Something like this?

VARIABLE_NAME=$(select COLUMN_NAME_1 from TABLE_NAME where COLUMN_NAME_2='VALUE_TO_CHECK")

or

VARIABLE_NAME=`select COLUMN_NAME_1 from TABLE_NAME where COLUMN_NAME_2='VALUE_TO_CHECK" `

if i give the first code its giving the error as 'ksh: select COLUMN_NAME_1 from TABLE_NAME where COLUMN_NAME_2='VALUE_TO_CHECK': not found'.

and for the second its just displaying the select statement as it is :frowning:

are you sure to input in the command with:

`

not

'