I have a script which has isql code in it which on passing values gives a studentId and a count as the output.
I write this output to a file and read the output from a java program.
In java program i pass a list of student information in a for loop to this script so that the sudents info is added to the file one after the other.
The problem is i have the student information pertaining to the last studentId passed to the script.
The previous ones are overwrittem by the new ones.
How do i have the info written to the file one after the other in new lines.
The script code is given below.
# Checking the prameters
if ( $# != 2 ) then
echo "Invalid Parameter"
isql -S$SQL_SRVR -D$DB_NAME -U$SYB_LOAD_ID -P$SYB_LOAD_PWD -b -w3000 -n -h0 -o $fileName <<!
set nocount on
select rtr.studentId,count (*)
from StudentTrackingRequest rtr, Attendence mtp, RollDistribution rd
where rtr.clientID = "$1"
and rd.clientID = rtr.clientID
and mtp.rtvStatusCode = 'VAL'
and rd.creationDateTime > 'Sep 7 2011 9:02:29:000AM'
and rd.atendenceDate >= '08/31/11'
and rd.atendenceDate <= '09/08/11'
group by rtr.clientID