Iterating through PL/SQL result in SHELL
问题 I want to iterate over PL/SQL rows in SHELL script and for each row I want to execute some code using current row. At this point I got: VALUE='sqlplus -s /nolog <<EOF CONNECT ${CONNECT} select smth from table; / EXIT EOF' for i in "${VALUE[@]}" do ##some code using "i" variable done At this point for 5 rows code executes only once. It appears it doesn't iterate at all. Any ideas how can I fix that? 回答1: You can iterate your resultset as follows: SQL> select car_model from available_models 2