You could do several things short of an array. For example:
for x in $( db2 -x "select...")
do
yada yada yada
done
or
db2 -x "select x, y, z from ..." | read x y z
do
yada yada yada
done
But the problem with ksh arrays I've worked with is knowing how many
elements you'll have so I guess you could do something like this. (
forgive me because I syntax may be off because I'm using windows right
now and don't have access to ksh )
counter=1
for x in $(db2 -x "select y from...")
do
arr[${counter}]=$x
counter=$(($counter+1))
done
The problem with this approach would be only being able to select one
column with the query.
HTH
kenfar - 18 Mar 2005 02:45 GMT
> The problem with this approach would be only being able to select one
column with the query.
Yeah, with multiple columns it can get easier to export to a delimited
file and read it back in and parse. Alternatively, the inclusion of
literal columns like '|' in the output can help facilitate parsing.
And at this point running from within python/ruby/perl - where you can
more easily capture the output to an easily-manipulated array can help
as well.
ken