|
My apologies for my example not being very clear. The "Actual SQL" shown in my OP is the value that the fetch will return into the shell variable "sqlrow". Since the Actual SQL has an "*" in it, when I echo $sqlrow, the * gets resolved and substitutes in the list of files from the current directory.
So, duh, I was able to resolve that by putting double quotes around the variable on the echo like : echo "$sqlrow"
Now, the plot thickens a bit. The sql is stored in a varchar(32000) on the source table. When I put the double quotes on the echo, I now get a record echo'd out that is 32000 bytes long. (The actual SQL statements will range from 50 - 10000 bytes). So, I don't want to write out all that extra space on the end of each record.
I can get the length of the sql, and I'm now trying to substr it in awk as follows where $rowlen contains the length of the sql:
sqltxt=`echo "$sqlrow"|awk '{print substr($0,1,$rl)}' rl=$rowlen`
However, I'm now getting the message "awk: record ` SELECT * F...' too long"
What is the best way for me to either suppress the extra spaces on the end of each record or to substr out the actual SQL??
|