Hi all,
I am new to shell scripting.I have made a simple shell script which will give me number of records in a database table. The SQL statement is working fine and there are 11 rows in this table. But problem is that it is not printing this value and fucntion does not get called. Please see the debug output at the end. The variable count2 does not get initialzed. Thanks.
#!/usr/bin/ksh
set -x
UIDPWD=`cat $TABS_HOME/.restrict/$ORACLE_SID`
export UIDPWD
get_number1()
{
set -x
sqlplus -s <<!
$UIDPWD
set head off
set feedback off
select count(*)
from MSC041501_090318A
/
exit
!
}
count2 = `get_number1`
echo "The total number of records in file is $count2"
Debug Output:
+ + cat /export/home/tabs/.restrict/TABST1
UIDPWD=its/its123
+ export UIDPWD
+ get_number1
+ sqlplus -s
+ 0<<
its/its123
set head off
set feedback off
select count(*)
from MSC041501_090318A
/
exit
+ count2 = 11
./count.sql[17]: count2: not found
+ echo The total number of records in file is
The total number of records in file is