Home » SQL & PL/SQL » SQL & PL/SQL » UTL_SMTP inline and attachment issue (10.2.0.3, HP UX)
icon5.gif  UTL_SMTP inline and attachment issue [message #434562] Wed, 09 December 2009 13:47 Go to next message
wcannon786
Messages: 2
Registered: December 2009
Location: US
Junior Member
Read in contents of files and Write text to email body if size is < 10k , otherwise to an attachment. Problem is after writing to an attachment we can't get it to switch to write the next file contents to the message body.
Example; we have 6 files in the table array. The first two files are less than 10k in size so the text from these files get written to the mail body. The third file size is 12k so the text gets written to an attachment. The 4th file is 2k but instead of being written to the email message body it gets appended to the previous attachment. All subsequent files of size < than 10k get appended to the attachment.
Re: UTL_SMTP inline and attachment issue [message #434564 is a reply to message #434562] Wed, 09 December 2009 14:02 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Go to the URL above click the link "Posting Guidelines"
Go to the section labeled "Practice" & do as directed.

Do you expect us to debug your 239 line file?
How can we begin without DDL for all tables & DML for test data?

Good Luck finding the logic flaw in the code!
Re: UTL_SMTP inline and attachment issue [message #434574 is a reply to message #434564] Wed, 09 December 2009 15:09 Go to previous message
wcannon786
Messages: 2
Registered: December 2009
Location: US
Junior Member
Procedure has no ddl or table access. The only items to substitute are valid smtp server, sender and recipient email addresses. Use any file < 10k bytes for FILENAME1, 12k file for FILENAME2 and a third file < 10k bytes for FILENAME3 so that contents of FILENAME1 is written to the email body, FILENAME2 contents are put in attachment and the contents of FILENAME3 will get appended to the attachment which is the problem.
Code notes:
Line 106- 118: email header text
line 130: loops thru the external files and missing files are simply skipped since exception block does not raise exception.
line 159: Tests to see if file message length > 10k
If TRUE then writes message contents from file to an attachment.
If FALSE then loops through message contents and writes to email body.
line 231: closes the data connection
line 232: quits the data connection

I hope this is enough to test the procedure.
Thank you
Previous Topic: Sql to get previous row value
Next Topic: avoid error message when drop a non-existing table
Goto Forum:
  


Current Time: Sat Feb 15 14:07:43 CST 2025