Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to pass parameters in UTL_HTTP

779365Jun 18 2010 — edited Jun 19 2010
Hi,

I was trying to use UTL_HTTP package to send sms. It is
working fine from SQL but if i am executing through
procedure, parameters are not considering properly and
throwing error, please help me to correct the code.

Paramaters
MobileNo = 123456789
Message = Hi

Ref-1 - Working fine
--------------------------------------------------------------------------------
SET DEFINE OFF

SELECT utl_http.request('http://100.111.102.35/testsms/SendSMS.aspx?UserName=test&password=test&MobileNo=123456789&SenderID=ADV&CDMAHeader=ADV&Message=Hi&isFlash=false') FROM dual;

Ref2
--------------------------------------------------------------------------------
create or replace PROCEDURE PRO_SEND_SMS
(P_MOB_NO NUMBER,
P_MESSAGE VARCHAR2) AS

lResponse VARCHAR2(1000);
BEGIN

SELECT utl_http.request('http://100.111.102.35/testsms/SendSMS.aspx?UserName=test&password=test&MobileNo=P_MOB_NO&SenderID=ADV&CDMAHeader=ADV&Message=P_MESSAGE&isFlash=false') into lResponse FROM dual;
DBMS_OUTPUT.PUT_LINE('SMS Response : '||L_RESPONSE);
END PRO_SEND_SMS;


Error
--------------------------------------------------------------------------------
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1577
ORA-12545: Connect failed because target host or object does not exist
ORA-06512: at line 1
ORA-06512: at "LIVEDB.PRO_SEND_SMS", line 9
ORA-06512: at line 8

Thanks,
Sam
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 17 2010
Added on Jun 18 2010
5 comments
3,860 views