|
|
|
|
|
|
|
Re: ORACLE LOG writting in unix from pl/sql [message #152177 is a reply to message #151848] |
Wed, 21 December 2005 09:09 |
cgk_js
Messages: 48 Registered: December 2005
|
Member |
|
|
hi rajendran,
pls find my findings..............
SQL> CREATE OR REPLACE PROCEDURE write_log
2 (
3 fname IN VARCHAR2 ,
4 message IN VARCHAR2 ,
5 mo IN VARCHAR2
6 )
7 IS
8 log_file UTL_FILE.FILE_TYPE; -- file handle for the log file
9 BEGIN
10 log_file := UTL_FILE.FOPEN('c:report',fname,mo);
11 UTL_FILE.PUTF(log_file,'%sn',message);
12 UTL_FILE.FCLOSE(log_file);
13 EXCEPTION
14 WHEN NO_DATA_FOUND THEN
15 DBMS_OUTPUT.PUT_LINE('no_data_found');
16 WHEN UTL_FILE.INVALID_PATH THEN
17 DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_PATH');
18 WHEN UTL_FILE.WRITE_ERROR THEN
19 DBMS_OUTPUT.PUT_LINE('UTL_FILE.WRITE_ERROR');
20 WHEN OTHERS THEN
21 DBMS_OUTPUT.PUT_LINE('other stuff');
22 END;
23 /
Procedure created.
SQL> begin
2 write_log('sampelfile.txt','hello world!','W');
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> set serveroutput on;
SQL> /
UTL_FILE.INVALID_PATH
PL/SQL procedure successfully completed.
i have tried for the valid directory too.............
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE write_log
2 (
3 fname IN VARCHAR2 ,
4 message IN VARCHAR2 ,
5 mo IN VARCHAR2
6 )
7 IS
8 log_file UTL_FILE.FILE_TYPE; -- file handle for the log file
9 BEGIN
10 log_file := UTL_FILE.FOPEN('c:\gopal',fname,mo);
11 UTL_FILE.PUTF(log_file,'%sn',message);
12 UTL_FILE.FCLOSE(log_file);
13 EXCEPTION
14 WHEN NO_DATA_FOUND THEN
15 DBMS_OUTPUT.PUT_LINE('no_data_found');
16 WHEN UTL_FILE.INVALID_PATH THEN
17 DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_PATH');
18 WHEN UTL_FILE.WRITE_ERROR THEN
19 DBMS_OUTPUT.PUT_LINE('UTL_FILE.WRITE_ERROR');
20 WHEN OTHERS THEN
21 DBMS_OUTPUT.PUT_LINE('other stuff');
22* END;
SQL>
SQL> /
Procedure created.
SQL> begin
2 write_log('sampelfile.txt','hello world!','W');
3 end;
4 /
UTL_FILE.INVALID_PATH
PL/SQL procedure successfully completed.
Pls help on this .....................
the concept behind is that i need to record the log entries in the unix log
from oracle and send the mail to the users regarding this.
Pls find the oracle version
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
|
|
|
|
Re: ORACLE LOG writting in unix from pl/sql [message #152458 is a reply to message #152178] |
Fri, 23 December 2005 05:40 |
cgk_js
Messages: 48 Registered: December 2005
|
Member |
|
|
Hi Mahendran,
I have created
the directory called /extract/gopal
for which i have given full permission.
chmod 777 /extract/gopal
still i find the invalid path error message is displayed.
also i the oracle version is the client version.
|
|
|
|
|
|
Re: ORACLE LOG writting in unix from pl/sql [message #152665 is a reply to message #152489] |
Mon, 26 December 2005 03:28 |
cgk_js
Messages: 48 Registered: December 2005
|
Member |
|
|
Hi mahesh Rajendran,
The scenario for me is that,
our projects has many trigerrs inbuilt for it, and the error message catched it self returns about 2000 character and also
exceeds more than that,
but standard buffer limits gets spooled up and
that why i want to write it in the file instead of displaying the error which is being catched in the exception.
|
|
|
|
Re: ORACLE LOG writting in unix from pl/sql [message #152827 is a reply to message #151258] |
Tue, 27 December 2005 03:11 |
cgk_js
Messages: 48 Registered: December 2005
|
Member |
|
|
exception
when others then
v_error := sqlerrm;
dbms_output.put_line('Error while updating Product code[' || v_prod_code || '] ' ||v_error);
when i execute the following error message is displayed.
i have also added the following line in the procedure,but still it is getting displayed.
dbms_output.enable(1000000);
ERROR at line 1:
ORA-20000: ORU-10028: line length overflow, limit of 255 chars per line
ORA-06512: at "SYS.DBMS_OUTPUT", line 35
ORA-06512: at "SYS.DBMS_OUTPUT", line 133
ORA-06512: at line 46
/
|
|
|
Re: ORACLE LOG writting in unix from pl/sql [message #152840 is a reply to message #151258] |
Tue, 27 December 2005 03:40 |
cgk_js
Messages: 48 Registered: December 2005
|
Member |
|
|
Hi mahesh,
I have also used
set serveroutput on size 1000000 wrapped;
but still the same error like sql buffer up to 255 chars is being displayed.
Then using the err length and using substr function
i have manually done to display the error, but it is not
wrapped.
is there any solutions exits for it.
Thanks
Gopal
|
|
|
|
|
|
|