sgmini
1
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
rdcwayx
2
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" `
sgmini
3
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
rdcwayx
4
are you sure to input in the command with:
`
not
'