> I have tried setting the option database > spool sql > spool sql to file as per one of the forum suggestion but we still getting the same error while extracting the data.
Spool to screen is easier than spool to file. We don't expect that Spool SQL will make you not have the error. It is merely to help diagnose the problem. So, perform the spool sql, and show us the output. Maybe then we can help.