I know now how to store the result of sql procédure in shell variable
testvar=$(sqlplus foo/bar @test.sql)
my test.sql return a list of integer that i would use in another select calling by my shell.
The aim of this procedure is to show the progress avancement of my treatment like
x=0;
while x <testvar.size
sqlplus foo/bar @test2.sql $testvar.x
print (x*100/testvar.size + "%")
end while
(i dont know shell programming but it’s easiest than my current problem…
If the output of
sqlplusis literally “A list of integers” as you describe, then this is easy enough.Presuming that “A list of integers” really means “A newline separated list of integers”
It’s not clear to me what
$testvar.xandtestvar.sizeare supposed to represent, so I made some guesses and left the variable$SOMETHINGto stand in for whatever testvar.size is supposed to be. If you want the total number of integers in the list fromsqlplusthen that would be different, and done like this:If your output is more complex some additional filtering will need to be done up front.