Marco van der Linden
Member³
A strange phenomenon occured whilst executing the code below (in a SQL Window). The status bar told me that the code was executed, but looking at the dbms_output tab the statements after the call to sendmailjpkg package were not printed. Running the code in a SQL*Plus it appeared that an ORA-24345 occured. I cannot say if this occurs in de command window as well, as the cause of the error has been fixed, but I find it strange that such an Oracle exception is not thrown by the SQL Window. (I think this should be reproducable by turning of the java mailer, but I'm not sure).
Code:
DECLARE
--
l_attachment_list sendmailjpkg.attachments_list := sendmailjpkg.attachments_list();
l_error_message VARCHAR2(250);
l_result NUMBER;
--
BEGIN
--
dbms_output.put_line('Begin');
--
l_attachment_list.extend;
l_attachment_list(1) := 'ORDERS_PROJECTS_NOT_CLOSED_19-AUG-2008.html';
l_attachment_list.extend;
l_attachment_list(2) := 'ORDERS_PROJECTS_CLOSED_19-AUG-2008.html';
l_attachment_list.extend;
l_attachment_list(3) := 'ORDERS_CANCELLED_19-AUG-2008.html';
--
dbms_output.put_line('Send mail');
--
l_result := SENDMAILJPKG.sendmail(smtpservername => 'mailhost'
,sender => 'development@database.com'
,recipient => 'recipient@gmail.com'
,subject => 'DVL'
,body => 'Test'
,errormessage => l_error_message
,attachments => l_attachment_list
);
--
dbms_output.put_line('After send mail');
-- dbms_output.put_line('Result: '||l_result);
-- dbms_output.put_line('Error Message: '||l_error_message);
--
EXCEPTION
WHEN OTHERS
THEN
dbms_output.put_line('Error: '||SQLCODE);
END;