12

How to use select into command in shell script?

view full story
linux-howto

http://www.unix.com – I need to get total number of rows in a table by using select count(*) from table and need to assign into a variable in shell script. I used the following script, it does return the number of rows but also with oracle headers, Please help me to eliminate this headers. Shell Script Code: #!/bin/sh count=`sqlplus $username/$password@$tnsname << EOF SET NEWPAGE 0 SET SPACE 0 SET LINESIZE 80 SET PAGESIZE 0 SET ECHO OFF SET FEEDBACK OFF SET HEADING OFF select count(*) from table; exit; EOF` echo "value is "$count O/P: Code: SQL*Plus: Release 10.2.0.4.0 (HowTos)