I have a procedure which count the number of rows in SMS_OUTBOX table and send emails if its row cont is over 1000. My procedure is given below:
CREATE OR REPLACE PROCEDURE SEND_EMAIL_ABOUT_PENDING_SMS IS
CHECK_SMS_COUNT NUMBER := 1000;
CURRENT_SMS_COUNT NUMBER;
BEGIN
SELECT COUNT(1) INTO CURRENT_SMS_COUNT FROM SMS_SCHEMA.SMS_OUTBOX;
IF CURRENT_SMS_COUNT >= CHECK_SMS_COUNT THEN
UTL_MAIL.SEND(
sender=>'<SENDER_EMAIL>',
recipients=>'<RECIPIENT_EMAIL>',
subject=>'Pending SMS',
Message=>'Pending SMS count exceeded.'
);
END IF;
END SEND_EMAIL_ABOUT_PENDING_SMS;
/
When I compile the above I got this error.
Then I tried this line of code to execute without the procedure:
EXEC UTL_MAIL.SEND(
sender=>'<SENDER_EMAIL>',
recipients=>'<RECIPIENT_EMAIL>',
subject=>'Pending SMS',
Message=>'Pending SMS count exceeded.'
);
Then I got this error:
PLS-00302: component 'SEND' must be declared
I am very new to Oracle (and PL/SQL). Can anyone please help me on sending emails in Oracle and what are the configurations needed?
Please check whether UTL_MAIL has been installed properly.
Follow the link UTL_MAIL for information and configuration required