I have a batchjob that takes the input from the database and the output to send an email with the rows from the database.

The issue that I am getting is for each row it's sending an email.I want the email for the entire resultset not for me.

Please let me know how can I achieve that.