Check the record count in table (table in oracle)

I have requirement:

1) Check the record count in table (table in oracle)
2) If records exists generate the file for existing records and wait for some time then Go to sleep mode and
Again check the record count after 10 min.......... (Loop this process if record count >0).
3) Generate touch file once table count is zero.

I need script for above scenario and i am poor in UNIX.
Please try to help me, please send full-length script if it is possible.

Generally, we're here to help, not do all the work for you. Here's a start to help you:

while true; do 
   records=`sqlplus "some sql code" `
   if [ $records = 0 ]; then 
       sqlplus "other sql code" > report.out
   fi
done

This doesn't do step 3 because I'm not sure what you mean by it.

Use this code to start on yours and come back here with a specific question when you are ready.