Forum Stats

  • 3,853,749 Users
  • 2,264,264 Discussions


problem in sending email with attachment more than 32kb through utl_mail

ankur.bhatia Member Posts: 49
edited Oct 14, 2008 5:51PM in SQL & PL/SQL
Hi friends

I am able to send an email with attachment upto 32kb using utl_mail.
But whenever I increase the size of attachment from 32kb, it prompts me an error.

ORA-20001: The following error has occured:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small

i have also used LONG RAW instead of RAW, bu still the problem is same.

please help me in solving this issue.

Thanks in advance,


  • Sentinel
    Sentinel Member Posts: 1,284 Silver Badge
    Are you trying to write the entire attachment with a single call to utl_smtp.write_\[raw\]_data? If not try writing the attachment in pieces.

    You snould be able to write just about any size attachment to the email you want as long as you work within the bounds of oracles data type constraints.
  • yes i am writing an attachment in pieces
    and i m using UTL_MAIL instead of UTL_SMTP
  • Sentinel
    Sentinel Member Posts: 1,284 Silver Badge
    Yeah that's an issue with UTL_MAIL it only has 3 procedures, and none of them let you send data to the SMTP server incrementally. To send files larger than 32k you will need to switch over to using UTL_SMTP directly or via a helper package such as the [DEMO_MAIL package|] available from otn.
This discussion has been closed.