ORA Directory error
Dear All
I have the below procedure which is compiling without errors. when i execute the procedure error comes as invalid directory.
ORA-20000: Failed to send mail due to the following error: ORA-29280: invalid directory path
I have define the directory and has given read and write access to the user. "/u01/oratest/ORA_DIR"
CREATE OR REPLACE PROCEDURE send_email_attach AS
fHandle utl_file.file_type;
vTextOut varchar2(32000);
text varchar2(32000) := NULL;
BEGIN
fHandle := UTL_FILE.FOPEN('/ORA_DIR/','Supplier.txt','r');
IF UTL_FILE.IS_OPEN(fHandle) THEN
DBMS_OUTPUT.PUT_LINE('File read open');
ELSE
DBMS_OUTPUT.PUT_LINE('File read not open');
END IF;
loop
begin
UTL_FILE.GET_LINE(fHandle,vTextOut);
IF text IS NULL THEN
text := text || vTextOut;
ELSE
text := text || UTL_TCP.CRLF || vTextOut;
END IF;
-- dbms_output.put_line(length(text));
EXCEPTION
WHEN NO_DATA_FOUND THEN EXIT;
end;
END LOOP;
--dbms_output.put_line(length(text));
UTL_FILE.FCLOSE(fHandle);
UTL_MAIL.SEND_ATTACH_VARCHAR2(sender => 'abc@xyz.com', recipients => 'efg@xyz.com', subject => 'Email_file', message => 'Hello', attachment => text, ATT_INLINE => FALSE);
EXCEPTION
WHEN OTHERS THEN
-- dbms_output.put_line('Fehler');
raise_application_error(-20000, 'Failed to send mail due to the following error: '||sqlerrm);
END;
/
Regards
Arif
Edited by: user3714906 on Jul 17, 2012 11:56 PM