Toad World® Forums

Fw: DBMS Output save to txt file


#1

att1.dat (43 Bytes)


#2

[ Attachment(s) from John Dorlon included below]

Make a script to run your pl/sql.

Go to app designer, DB Misc tab.

Create an “Execute Script” action.

Double-click it to set properties.

See attachemnt


#3

image004.gif


#4

att1.dat (1.6 KB)


#5

att1.dat (43 Bytes)


#6

Did you include a “set serveroutput on” at the top of your file?


#7

E ric,

if you have a proc like:

create or replace procedure dbmsoutput_proc
as
begin
dbms_output.put_line('this is output from my proc');
end;

and execute the script as:

set serveroutput on
spool c:\myoutput.txt
exec dbmsoutput_proc;
spool off;

you’ll get output like:

this is output from my proc
PL/SQL procedure successfully completed.

Is this what you’re looking for?


#8

In the past, I created a logging package that let me control whether debug
messages went to DBMS_OUTPUT (console), a text file on the server via UTL_FILE,
both, or turn them off entirely. I probably have the code at home, but it
didn’t take more than a day to write it either.

Dan Clamage

Oracle Database Developer

C O N F L U E N C E

412.246.1806 direct

412.802.8632 main

412.802.8647 fax

THE MATERIAL CONTAINED IN THIS MESSAGE IS CONFIDENTIAL AND IS SUBJECT TO
RESTRICTIONS ON ITS DISCLOSURE. The recipient acknowledges that the information
contained herein is the exclusive, proprietary and confidential property of
Confluence Technologies, Inc. and shall be at all times regarded, treated and
protected as such by the recipient. The use and disclosure of this information
is subject to the restrictions contained in the Software License Agreement
between the recipient (or the recipient’s employer or its affiliates) and
Confluence Technologies, Inc.


#9

image004.gif


#10

att1.dat (43 Bytes)


#11

Eric,

Unfortunately, I could not find this code at home.

The gist of it was, I had a private-global packaqe variable I exposed via
get-set routines to control the destination. I used a string to represent three
flags: (F)ile, (T)able, ©onsole. The debug-logging packaged procedure was
overloaded to handle filenames for the UTL_FILE-based routine. Whether to
enable/disable logging was based on a 2nd private-global debug variable.

IF (isdebug_on) THEN

IF (get_trace LIKE ‘%F%’) THEN

– write to a logfile using UTL_FILE

END IF;

IF (get_trace LIKE ‘%T%’) THEN

– write to a logging table via an Autonomous Transaction procedure

END IF;

IF (get_trace LIKE ‘%C%’) THEN

– use DBMS_OUTPUT

END IF;

END IF;

The UTL_FILE routine opened, wrote and closed everytime. While this does add a
bit of overhead, the results can be seen immediately (the close performs a
flush) and different files can be logged to during a session (one for different
purposes).

Dan Clamage

Oracle Database Developer

C O N F L U E N C E

412.246.1806 direct

412.802.8632 main

412.802.8647 fax

THE MATERIAL CONTAINED IN THIS MESSAGE IS CONFIDENTIAL AND IS SUBJECT TO
RESTRICTIONS ON ITS DISCLOSURE. The recipient acknowledges that the information
contained herein is the exclusive, proprietary and confidential property of
Confluence Technologies, Inc. and shall be at all times regarded, treated and
protected as such by the recipient. The use and disclosure of this information
is subject to the restrictions contained in the Software License Agreement
between the recipient (or the recipient’s employer or its affiliates) and
Confluence Technologies, Inc.