hi folks
i am facing problom while trying to access sql variable as array index ina unix shell script....script goes as below..
#!/bin/ksh
MAX=3
for elem in alpha beeta gaama
do
arr[$x]=$elem
((x=x+1))
Done
SQL_SERVER='servername'
/apps/sun5/utils/sqsh -S $SQL_SERVER -U user -P pwd -b -h <<EOF
set nocount on
go
use DBname
go
declare @MaxID int
set @MaxID=0
print $MAX
while @MaxID < $MAX
begin
print ${arr[@MaxID]}
set @MaxID=@MaxID+1
end
print 'endof while'
go
EOF
Is the script...
Prob is not able to use @MaxId as array subscript since it is a sql variable and array is used inside sqsh mode i.e sql prompt ...
Any way to access the unix array in side sql prompt based on index....???? Hope i made my self clear.
Thanks in advance.