I have created shell script to run sql query something like below. i can use this script with only few arguments. But how can i modify the script if empno is huge in numbers.
For example
./script.ksh 1234
select *
from emp
where empno in $1
I have created shell script to run sql query something like below. i can use this script with only few arguments. But how can i modify the script if empno is huge in numbers.
For example
./script.ksh 1234
select *
from emp
where empno in $1
One way is to use sql loader to move the empnos in a table.
Regards
Another way is the enter all the emp nos in a seperte file and read it within the script and prepare the string
s=""
while read line;
do
if [ s == "" ]; then
s="'$line,'"
else s="$s""'$line'"","
fi;
done < empno;
str=`echo "$s"|sed -e 's/^/\(/g' -e 's/,$/\)/g'`
echo $str
cheers,
Devaraj Takhellambam