Throw '&' String Url on Oracle stored procedure -


i want call url oracle stored procedure.

/* formatted on 11/10/2016 19:04:58 (qp5 v5.185.11230.41888) */ declare    req     utl_http.req;    resp    utl_http.resp;    value   varchar2 (1024); begin    req := utl_http.begin_request ('http://11.123.33.32:8002/cool/value?car=ferrari&home=california');    utl_http.set_header (req, 'user-agent', 'mozilla/4.0');    resp := utl_http.get_response (req);     loop       utl_http.read_line (resp, value, true);       dbms_output.put_line (value);    end loop;     utl_http.end_response (resp); exception    when utl_http.end_of_body          utl_http.end_response (resp); end; / 

but cannot read '&' string on oracle, how supposed call url in stored procedure ?

you use url encoding.

url encoding replaces unsafe ascii characters % followed 2 hexadecimal digits. can replace & equivalent 'safe' version %26.

thus, url become

'http://11.123.33.32:8002/cool/value?car=ferrari%26home=california'

meaning, replace 1 line in code

req := utl_http.begin_request ('http://11.123.33.32:8002/cool/value?car=ferrari&home=california');

becomes

req := utl_http.begin_request ('http://11.123.33.32:8002/cool/value?car=ferrari%26home=california');


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -