I am having trouble logging the sql errors from sqlplus. I am executing a sql script from a bat file using sqlplus with following command: sqlplus dbusrid/dbpass @export_data.sql >> log.log
The script is outputting the results of a select to a csv file using spool as follows:
set echo off
set feedback off
set pagesize 0
set termout off
set heading off
set trimspool on
select col1 || ',' || col2 || ',' || col3 from
If a sql error occurs then the output.csv is populated with the error. Is it possible to populate an error log with sql errors instead of or in addition to the output.csv?
Ideally I would like all error output to be logged in the log.log file which is being populated from the bat file cmd mentioned above.
I am new to oracle and sqlplus so Im sorry if this is a trivial question but I cannot seem to find the correct method.
Edited by: user1099073 on Jan 3, 2013 10:53 PM
Is it possible to populate an error log with sql errors instead of or in addition to the output.csv?
No, it is not possible to separate all errors into an error log. You can create only one output file via the spool command.
This file will also contain all sql errrors.
But: you can log all errors to a logging table (a default table or user defined) using a new sqlplus feature.