Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> PL/SQL, UTL FILE dynamic read v$parameter
Hello,
Is it possible in PL/SQL to read v$parameter and pass the value for utl_file_dir to the UTL_FILE.FOPEN statement? This is my current attempt, and it's failing with the error, below.
select value into v_utl_file_dir_name from v$parameter where name = 'utl_file_dir' ;
fileid0 := UTL_FILE.FOPEN(v_utl_file_dir_name,'sequence_data','W') ;
BEGIN table_sequence_mender (sysdate, 'dev01') ; END;
*
ERROR at line 1:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "SYS.UTL_FILE", line 98
ORA-06512: at "SYS.UTL_FILE", line 157
ORA-06512: at "DBAUSER.TABLE_SEQUENCE_MENDER", line 29
ORA-06512: at line 1
Using this line instead, the open works just fine:
fileid0 := UTL_FILE.FOPEN('/opt/oracle/u05/oradata/dev01/orafile','sequence_data','W') ;
I'm building a procedure that can be installed on any system and not have a hardcoded external path.
Hints, tips, rtfm, etc. are welcome.
Thanks, Linda Received on Mon Nov 19 2001 - 13:40:50 CST
![]() |
![]() |