I am trying to query a table having 3 columns, the third column is a field of varchar(1024) with a SQL string in it. I am using cut command to split out the three fields into three variables. I do a db2 command to extract the data into a file.
My problem is with the third field having the SQL command. Example of data in the third field is "select A.* from TRAN with UR;"
When the assignment
query=`cat $TMP/adwtdtemp.tmp | cut -d '#' -f 3 | cut -d ';' -f 1` is executed, and when the contents of query variable is displayed, I get A.* subsituted with all file names matching A.*"
I tried the same with a simple script
#!/bin/ksh
echo "select A.* from abc"
echo $str
str="select A.* from abc"
query=${str}
echo $query
exit 0
The output is
select A* from abc (from echo $str)
select A.ksh A.log A.sh A.x from abc (from echo $query)
How do I make the script just assign the string and not do any substitutions?
Any help is appreciated.
Thanks