0

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?

Dhiraj Neve
  • 235
  • 2
  • 4
  • 11

1 Answers1

0

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
Nick Krasnov
  • 26,886
  • 6
  • 61
  • 78
  • No, I am not planning to call it from ttisql.. I am going to trigger this procedure from c++ code.. – Dhiraj Neve Sep 08 '12 at 17:57
  • then in addition to @Candie answer take a look at this http://stackoverflow.com/questions/1453538/how-to-redirect-the-output-of-dbms-output-put-line-to-a-file – Nick Krasnov Sep 08 '12 at 18:11
  • Yeah, i already gone through this question. But it works fine for Oracle. My stored procedure is in TimesTen, not in Oracle. – Dhiraj Neve Sep 08 '12 at 19:09
  • 1
    TimesTen also has UTL_FILE package http://docs.oracle.com/cd/E21901_01/doc/timesten.1122/e21645/u_file.htm#BABGGEDF – Nick Krasnov Sep 08 '12 at 19:20
  • Great !! Thanks, TimesTen has this support from 11.2.2 release. I was using older one.. Hence I was not able to use UTL_FILE package. – Dhiraj Neve Sep 08 '12 at 19:27