Prerequisites
Before you begin:
- Oracle Database 11g or higher
- A SpringEdge account with an API key and your SMS service URL (
<SMS_SERVICE_URL>, shared after sign-up) - DBA privileges to configure ACL (Access Control List)
- Oracle Wallet configured for HTTPS (SSL) connections
Direct from Database
No middleware, no application layer — send SMS from PL/SQL
DBMS_SCHEDULER
Schedule SMS sends using Oracle's built-in job scheduler
ACL Secured
Oracle ACL controls which schemas can make outbound HTTP calls
CREATE OR REPLACE PROCEDURE send_sms(
p_phone IN VARCHAR2,
p_message IN VARCHAR2
) AS
l_url VARCHAR2(200) :=
'<SMS_SERVICE_URL>/api/web/send/';
l_api_key VARCHAR2(100) := 'YOUR_API_KEY';
l_params VARCHAR2(4000);
l_req UTL_HTTP.REQ;
l_resp UTL_HTTP.RESP;
l_body VARCHAR2(4000);
BEGIN
-- Build URL-encoded form body
l_params := 'apikey='
|| UTL_URL.ESCAPE(l_api_key, TRUE)
|| '&sender=SEDEMO'
|| '&to=' || UTL_URL.ESCAPE(p_phone, TRUE)
|| '&message='
|| UTL_URL.ESCAPE(p_message, TRUE, 'UTF-8')
|| '&format=json';
-- Set wallet for HTTPS
UTL_HTTP.SET_WALLET(
'file:/oracle/wallet', 'wallet_pwd');
-- Make HTTP POST request
l_req := UTL_HTTP.BEGIN_REQUEST(
l_url, 'POST', 'HTTP/1.1');
UTL_HTTP.SET_HEADER(l_req, 'Content-Type',
'application/x-www-form-urlencoded');
UTL_HTTP.SET_HEADER(l_req,
'Content-Length', LENGTHB(l_params));
UTL_HTTP.WRITE_TEXT(l_req, l_params);
-- Get response, e.g.
-- {"groupID": 61, "MessageIDs": "61-1",
-- "status": "AWAITED-DLR"}
-- or a plain-text error such as
-- Invalid Sender ID
l_resp := UTL_HTTP.GET_RESPONSE(l_req);
UTL_HTTP.READ_TEXT(l_resp, l_body);
UTL_HTTP.END_RESPONSE(l_resp);
DBMS_OUTPUT.PUT_LINE(l_body);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
/
PL/SQL CODE
PL/SQL Stored Procedure
This stored procedure uses UTL_HTTP to send a form-encoded HTTPS POST to <SMS_SERVICE_URL>/api/web/send/ (your SMS service URL, shared after sign-up). Every value is URL-encoded with UTL_URL.ESCAPE, the API key is passed as the apikey parameter, and the message must match a DLT-approved template. See the SMS API documentation for all parameters.
Call it from any PL/SQL block, trigger, or scheduled job:
BEGIN
send_sms('9900XXXXXX',
'Your order has been shipped.');
END;
/
ACL Configuration:
BEGIN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(
acl => 'springedge.xml',
principal => 'YOUR_SCHEMA',
is_grant => TRUE,
privilege => 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(
acl => 'springedge.xml',
-- host of your SMS service URL
host => 'your-sms-service-host',
lower_port => 443);
COMMIT;
END;
/
Use Cases
Transaction Alerts
Send SMS alerts when financial transactions are posted — payments, refunds, credits, and debits.
Scheduled Reports
Use DBMS_SCHEDULER to send daily/weekly SMS summaries to managers — outstanding balances, overdue invoices, KPI alerts.
Database Triggers
Trigger SMS from INSERT/UPDATE events — e.g., SMS when a new order row is inserted into the orders table.
Monitoring Alerts
Send SMS when tablespace usage exceeds thresholds, long-running queries are detected, or deadlocks occur.
