问题
I want to create procedure to send SMS to the Indian mobile user via oracle11g database. I have searched alot but can't find a neat procedure
回答1:
Sending e-mails from Oracle database is one thing but sending SMS from the database is a whole lot of other things.
You will need the service of any third party who can provide APIs for your requirement. (Handle sending of sms from the application)
Try smscountry
回答2:
You may wrap the entire procedure and call it against a table trigger or through a button click available with user form
SET serveroutput ON
SET Define OFF
DECLARE
HTTP_REQ UTL_HTTP.REQ;
HTTP_RESP UTL_HTTP.RESP;
URL_TEXT VARCHAR2(32767);
URL VARCHAR2(2000);
SMS_MSG VARCHAR2(160) := 'Congratulations! Your database has been configured propoerly for sending SMS through a 3rd party SMS Gateway';
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
--Based on your service provider, the following link format may differ from
--What we have specified below!
URL := 'http://yourwebsmsdomain.com/alerts/api/web2sms.php?username=demo&password=demo2&to=95xxxxxxx&sender=ODBSMS&message='||
UTL_URL.Escape(SMS_MSG,TRUE);
--UTL_URL.Escape manages escape characters like SPACE between words in a message.
HTTP_REQ := UTL_HTTP.BEGIN_REQUEST(URL);
UTL_HTTP.SET_HEADER(HTTP_REQ, 'User-Agent', 'Mozilla/4.0');
HTTP_RESP := UTL_HTTP.GET_RESPONSE(HTTP_REQ);
-- Process Request
LOOP
BEGIN
URL_TEXT := null;
UTL_HTTP.READ_LINE(HTTP_RESP, URL_TEXT, TRUE);
DBMS_OUTPUT.PUT_LINE(URL_TEXT);
EXCEPTION
WHEN OTHERS THEN EXIT;
END;
END LOOP;
UTL_HTTP.END_RESPONSE(HTTP_RESP);
END;
回答3:
You need to set up a web service (php file that you can call from Oracle) which you can all using soap_api.
来源:https://stackoverflow.com/questions/29466412/how-to-send-sms-via-oracle-11g-client-is-toad-and-in-india-i-have-to-send-sms