Home
All Oracle Error Codes
Oracle DBA Forum

Frequent Oracle Errors

TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated

UTL_MAIL

vishal shah

2005-07-26

Replies:
Hi List,

Has somebody used UTL_MAIL in 10g for sending emails with attachments?
I'm using the following procedure:

CREATE OR REPLACE PROCEDURE mail_attach (dir1 VARCHAR2, filename VARCHAR2)
AS
  l_output  utl_file.file_type;
  l_file       RAW(32767);
  l_size       NUMBER;
  BLOCK       NUMBER;
  b          BOOLEAN;
  l_start NUMBER := 1;
  TYPE ARRAY IS TABLE OF VARCHAR2(255);
  l_data ARRAY := ARRAY('whizkid420@(protected)');
 BEGIN
  UTL_FILE.FGETATTR(dir1, filename, b, l_size, BLOCK);
  l_output := utl_file.fopen(dir1, filename, 'r' );
  utl_file.get_raw(l_output, l_file, l_size);
  utl_file.fclose( l_output );
  FOR i IN l_start .. l_data.COUNT
  LOOP
    UTL_MAIL.SEND_ATTACH_RAW (
        sender   => 'Mailer',
        recipients => l_data(i),
        subject   => 'Data for ' || TO_CHAR((SYSDATE-1),'DD-MON-YYYY'),
        attachment => l_file,
        message   => 'Dear User, Please find attached the upload
data for the period mentioned in the subject line.',
        att_inline => FALSE,
        att_filename => filename);
       l_start := l_start + 1;
  END LOOP;
 END;
/

If I attach a file which is less than 32767 bytes (as specified in the
declaration), it sends the mail successfully. But it the filesize
exceeds then it gives the following error:

PROD@(protected)')

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.54
PROD@(protected)')
BEGIN mail_attach('UTL_PATH','KFL20-26-JUN-2005'); END;

*
ERROR at line 1:
ORA-06525: Length Mismatch for CHAR or RAW data
ORA-06512: at "SYS.UTL_FILE", line 119
ORA-06512: at "SYS.UTL_FILE", line 1100
ORA-06512: at "PROD.MAIL_ATTACH", line 15
ORA-06512: at line 1


Elapsed: 00:00:00.03

How can I send attachments larger than 32767 bytes? Thanks a lot for your help!
--
http://www.freelists.org/webpage/oracle-l