How to redirect 'dbms_output.put_line content' to log file from a TimesTen Stored Procedure

StackOverflow https://stackoverflow.com/questions/12332816

  •  30-06-2021
  •  | 
  •  

Question

See the sample Timesten procedure below.

CREATE OR REPLACE PROCEDURE test_proc(employee_id IN NUMBER) AS
salary NUMBER;
BEGIN
SELECT emp_sal INTO salary FROM employee where emp_id = employee_id;
DBMS_OUTPUT.PUT_LINE('Employee Id:' || employee_id || ' Annual Income:' || salary*12);
END;
/

If I call the procedure from Command line interface(ttisql), dbms_output.put_line logs gets printed there only. But I want to collect such debug logs to somewhere else in a log file. Whenever procedure get executed it should append these content to a file. Is there any possible way to do that?

Was it helpful?

Solution

If you are calling your procedure from ttisql as you've said you can use spool filepath and spool off to log any messages appeared on the screen. To append new information to the already existed log file just use APPEND option after filepath

spool c:\logfile.log append
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top