Hi
Often it can be useful to return the result of a simple SQL*Plus query to a shell script variable, for example to check for a value before deciding wether or not to proceed. The syntax is actually pretty simple :
#!/bin/sh
count=$(sqlplus -s 'scott/tiger@xe'<<EOF
set pages 0 feed off
select count(*) from tab;
EOF
)
echo $count
Enjoy!
Tags: Oracle, shell script, sqlplus