in reply to Here document and sqlplus
print SQLPLUS <<SQL spool anyfile.log; select * from tab where tnam like 'monks'; spool off SQL close SQLPLUS; [download]