Skip to Main Content

SQL & PL/SQL

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!

utl_http parameter with escape character

rthampiJun 24 2013 — edited Jun 24 2013

Hi guys

We are setting up our database to send SMS through a gateway and having a small problem with parsing the message to htl_http package. We use the below script to send SMS

DECLARE

    HTTP_REQ      UTL_HTTP.REQ;

    HTTP_RESP     UTL_HTTP.RESP;

    URL_TEXT      VARCHAR2(32767);

    URL VARCHAR2(2000);

   

    SMS_MSG VARCHAR2(160) :='This is a test message sent from Oracle Database';

   

BEGIN

    DBMS_OUTPUT.ENABLE(1000000);

   

    URL := 'http://mysmsgateway/alerts/api/web2sms.php?username=test&password=test&to=9999555555&sender=ORASMS&message='||SMS_MSG;

        

    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;

Now our problem is, while the SMS is received, we just get "This" which is the first word from SMS_MSG variable. It is due to escape character handling, we believe. How do we "Escape" this issue?

Any suggestions?

Regards,

Raj

This post has been answered by Chris Hunt on Jun 24 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2013
Added on Jun 24 2013
3 comments
895 views