Home » SQL & PL/SQL » SQL & PL/SQL » set that init.ora file(utl_file_dir).
set that init.ora file(utl_file_dir). [message #232132] Thu, 19 April 2007 10:33 Go to next message
chandrasekharbomminisidda
Messages: 21
Registered: March 2007
Location: Chennai
Junior Member
I am having this function, When i tried to execute this function i am getting error ,

ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 33
ORA-06512: at "SYS.UTL_FILE", line 436
ORA-06512: at "OTSLGDW.DUMP_CSV", line 17
ORA-06512: at line 1

I need to set init.ora file(utl_file_dir), But i am not able to set that init.ora file(utl_file_dir). i saw in dbs directory but it's not there. Then i was tried in sql prompt by typing show parameters, I got the parameter value as /uprod/oradwhs/edi/outbound
But i am not able to edit that i mean not able to update manually. How i can achieve this ? Is there any Command is there or not ?

Please guide me rearding this problem.

create or replace function dump_csv( p_query in varchar2,
p_separator in varchar2
default ',',
p_dir in varchar2 ,
p_filename in varchar2 )
return number
AUTHID CURRENT_USER
is
l_output utl_file.file_type;
l_theCursor integer default dbms_sql.open_cursor;
l_columnValue varchar2(2000);
l_status integer;
l_colCnt number default 0;
l_separator varchar2(10) default '';
l_cnt number default 0;
begin
l_output := utl_file.fopen( p_dir, p_filename, 'w' );

dbms_sql.parse( l_theCursor, p_query, dbms_sql.native );

for i in 1 .. 255 loop
begin
dbms_sql.define_column( l_theCursor, i,
l_columnValue, 2000 );
l_colCnt := i;
exception
when others then
if ( sqlcode = -1007 ) then exit;
else
raise;
end if;
end;
end loop;

dbms_sql.define_column( l_theCursor, 1, l_columnValue,
2000 );

l_status := dbms_sql.execute(l_theCursor);
dbms_output.put_line(l_status);

loop
exit when ( dbms_sql.fetch_rows(l_theCursor) <= 0 );
l_separator := '';
for i in 1 .. l_colCnt loop
dbms_sql.column_value( l_theCursor, i,
l_columnValue );
utl_file.put( l_output, l_separator ||
l_columnValue );
l_separator := p_separator;
end loop;
utl_file.new_line( l_output );
l_cnt := l_cnt+1;
end loop;
dbms_sql.close_cursor(l_theCursor);

utl_file.fclose( l_output );
return l_cnt;
end dump_csv;


Sincerely,
Chandrasekhar B.S.
Re: set that init.ora file(utl_file_dir). [message #232133 is a reply to message #232132] Thu, 19 April 2007 10:35 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10672
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
for versions 9i and above, use create directory instead of UTL_FILE_DIR.

http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#998101

[Updated on: Thu, 19 April 2007 10:38]

Report message to a moderator

Re: set that init.ora file(utl_file_dir). [message #232152 is a reply to message #232133] Thu, 19 April 2007 11:35 Go to previous message
chandrasekharbomminisidda
Messages: 21
Registered: March 2007
Location: Chennai
Junior Member
Dear Sir,

Thank's a lot for your timely Rely.

Regards,
Chandrasekhar B.s.
Previous Topic: ALTER TABLE in a trigger
Next Topic: Formatting pl/sql output
Goto Forum:
  


Current Time: Fri Dec 02 16:29:04 CST 2016

Total time taken to generate the page: 0.26583 seconds