Hi.
I need to output a 4 queries result into another application using
result=`sqlplus -s ${3}/${4}@${2} << EOF
...
query1
query2
query3
query4
....
echo "$metrics1"
and returning those individual values into another app.
(query1 and 3compute one value, query 2 and 4 compute 4 values. All of them floats)
For a normal situation I output the values this way,
server_avail1=`echo $tt1| awk '{print $1}'`; server_term1=`echo $tt1| awk '{print $7}'`;
server_menu_avail=`echo $tt1| awk '{print $2}'`; server_menu_avail=`echo $tt1| awk '{print $3}'`; ...............
the problem I'm facing is sometimes some values of a query are returned NULL and thus aren't echoed, which breaks my static outputting (and if the 1st value of the 2nd query goes NULL, the values that goes into server_menu_avail is the 2nd val of the 2nd query, etc)
To gain a little control, I tried to force substituting those NULLs with a 'NULL' word
echo "$scfmetrics1" | sed 's/^$/NULL/g'
but it's getting an extra NULL between the result of query1 and 2, and query 3 and 4.
Eg: 0 NULL NULL 100 NULL 100 100 NULL 0 NULL NULL 88.46 NULL 99.12 100
Any idea how to skin this rabbit?