Link to home
Start Free TrialLog in
Avatar of dgupta70
dgupta70

asked on

utl_file.invalid_path

I am facing problem in executing the package
ORA-06510: PL/SQL: unhandled user-defined exception

ORA-06512: at "SYS.UTL_FILE", line 534

ORA-06512: at "SYSTEM.MYDEBUG", line 56

ORA-06512: at "SYSTEM.MYDEBUG", line 66

ORA-06512: at line 3

 
My package is
============
CREATE OR REPLACE PACKAGE Mydebug AS
   
        -- Define a variable to hold the file id for all debugging actions.
        FileId utl_file.file_type;
     
     
     -- This procedure will initialise the debugging system by opening the debugging file. You
     -- could add more stuff here if you wish.
     PROCEDURE Initialise(iPath IN VARCHAR2, iFile IN VARCHAR2, iBuffer IN NUMBER := 256);
   
    -- This procedure terminates the debugging system - simply by closing whichever file is open.
    -- Although UTL_FILE allows a number of files to be open at any time, this is a simple
    -- system and only has a single debugging file.
    PROCEDURE TERMINATE;
   
    -- And the guts of the package is this simple procedure to send whatever is passed to it,
    -- straight out to the logging file. The option to flush the buffer contents is provided.
    PROCEDURE debug_out(iText IN VARCHAR2, iFlush IN BOOLEAN := FALSE);
     PROCEDURE Test(File IN VARCHAR2);
   
   END;
/
CREATE OR REPLACE PACKAGE BODY Mydebug AS
       -- Define a variable to hold the file id for all debugging actions.
        -- FileId utl_file.file_type;
     
     
     -- This procedure will initialise the debugging system by opening the debugging file. You
     -- could add more stuff here if you wish.
     PROCEDURE Initialise(iPath IN VARCHAR2, iFile IN VARCHAR2, iBuffer IN NUMBER := 256)
    AS
    BEGIN
       Dbms_Output.put_line('ipath = '||iPath ||'File '||iFile);
       Mydebug.FileId := utl_file.fopen(iPath, iFile, 'W', iBuffer);
       Mydebug.debug_out('Debugging session begins at ' || TO_CHAR(SYSDATE));    
    EXCEPTION
         WHEN utl_file.invalid_path THEN
           Dbms_Output.put_line('utl_file.invalid_path');
           --RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_path');
         WHEN utl_file.invalid_mode THEN
           --RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_mode');
           DBMS_OUTPUT.put_line('utl_file.invalid_mode');
         WHEN utl_file.invalid_filehandle THEN
            DBMS_OUTPUT.put_line('utl_file.invalid_filehandle');
           --RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_filehandle');
         WHEN utl_file.invalid_operation THEN
           --RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_operation');
           DBMS_OUTPUT.put_line('utl_file.invalid_operation');
         WHEN utl_file.read_error THEN
           --RAISE_APPLICATION_ERROR(-20001, 'utl_file.read_error');
           DBMS_OUTPUT.put_line('utl_file.read_error');
         WHEN utl_file.write_error THEN
           --RAISE_APPLICATION_ERROR(-20001, 'utl_file.write_error');
           DBMS_OUTPUT.put_line('utl_file.write_error');
         WHEN utl_file.internal_error THEN
           --RAISE_APPLICATION_ERROR(-20001, 'utl_file.internal_error');
           DBMS_OUTPUT.put_line('utl_file.internal_error');
         WHEN OTHERS THEN
           --RAISE_APPLICATION_ERROR(-20001, 'utl_file.other_error');
           DBMS_OUTPUT.put_line('utl_file.other_error');
       END;
   
    -- This procedure terminates the debugging system - simply by closing whichever file is open.
    -- Although UTL_FILE allows a number of files to be open at any time, this is a simple
    -- system and only has a single debugging file.
    PROCEDURE TERMINATE
    AS
    BEGIN
       Mydebug.debug_out('Debugging session terminated at ' || TO_CHAR(SYSDATE));
       utl_file.fclose(Mydebug.FileId);
    END;
   
    -- And the guts of the package is this simple procedure to send whatever is passed to it,
    -- straight out to the logging file. The option to flush the buffer contents is provided.
    PROCEDURE debug_out(iText IN VARCHAR2, iFlush IN BOOLEAN := FALSE)
    AS
    BEGIN
       utl_file.put_line(Mydebug.FileId, iText);
       IF (iFlush) THEN
         utl_file.fflush(Mydebug.FileId);
       END IF;
    END;
    PROCEDURE Test(File IN VARCHAR2)
    AS
    BEGIN
         Mydebug.INITIALISE('e:\TrueUpData\',File);
       FOR something IN 1..100 LOOP
         Mydebug.DEBUG_OUT('Currently processing record : ' || TO_CHAR(something));
       END LOOP;
 
       Mydebug.TERMINATE;
   END;    
   
   END;
/

My test file is
=========
declare
  -- Local variables here
  i integer;
begin
  Mydebug.Test('test.log');
  end;


My package is pretty simple.
I have the directory and i have the permissions.
I am on Win2000 server.

Can anyone help me with this.

Thanks
Deepak
ASKER CERTIFIED SOLUTION
Avatar of jrb1
jrb1
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial