How to capture value in shell variable from oracle sql?

Hi Friends,

Do someone know how to capture value in a shell variable from oracle sql?

Requirement : In a table we want to count the number of records and want to pass this value to a shell variable where it can be manipulated later. In ksh shell we open oracle connection from sqlplus.

For example :

sqlplus user/passwd <<EOF
variable v_1 number;
select count(*) into :v_1 from table;
exit
EOF

In a shell variable we want to capture the value of v_1..then what is exact syntex to do it?

Thanks in advance.

I have posted today about the same problem.You just need to copy paste.

Please check this link http://www.unix.com/shell-programming-scripting/82370-problems-sqlplus-shellscript.html