Parallel execution of Oracle PROC in UNIX

Hi,

Trying to run the Oracle Proc in parallel, but not working.. below code runs each call of the procedure and its coming out of the loop before its completion and printing the last statement! not waiting for the sqlplus to complete.

for name in `cat abc.txt`
do
(sqlplus -s  usert/password@host <<-EOF>> error.txt
			SET LINESIZE 1000
			select '$name', TO_CHAR(current_timestamp(0),'DD-Mon-YYYY HH24:MI:SS') as start_time from dual;
			EXEC proc('$name');
			select '$name' ,TO_CHAR(current_timestamp(0),'DD-Mon-YYYY HH24:MI:SS') as end_time from dual;
			EOF
 ) &
done

run the below part only if all the loops in the for has completed!
echo "Complete"

if i have like 10 different lines in the abc.txt, i need to have the code running parallely for each and complete the entire for loop only after all the 10 has completed, ie the start time for all the proc call should be same.

Try the wait statement after the done . Be aware that due to DB locking the processes may not truely execute in parallel.

i added wait, and it did work properly. Thanks for the prompt reply.

Now i have new req., run only 3 sqlplus at a time. Is there a way we can restrict it in the for loop?

Please open an new thread for a new request.
This question has been answered umpteen times in these forums. Try the search function. In a new thread with a good, descriptive title, there are related proposals in the lower left under "More UNIX and Linux Forum Topics You Might Find Helpful"