Rahul Bagal
asked on
Escape Character for &
I am writing following Program to Access HTTP url
DECLARE
req utl_http.req;
resp utl_http.resp;
value VARCHAR2(1024);
URL VARCHAR2(1024);
BEGIN
url := 'http://10.202.12.17:8080/login.asp?user=XYZ&pass=yzx123';
req := utl_http.begin_request(url );
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 THEN
utl_http.end_response(resp );
END;
in this Program I need Escape Character for & at line
url := 'http://10.202.12.17:8080/login.asp?user=XYZ&pass=yzx123';
when I run the code it asks
Enter value for pass:
Instead & is part of string
Thanks in advance
DECLARE
req utl_http.req;
resp utl_http.resp;
value VARCHAR2(1024);
URL VARCHAR2(1024);
BEGIN
url := 'http://10.202.12.17:8080/login.asp?user=XYZ&pass=yzx123';
req := utl_http.begin_request(url
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 THEN
utl_http.end_response(resp
END;
in this Program I need Escape Character for & at line
url := 'http://10.202.12.17:8080/login.asp?user=XYZ&pass=yzx123';
when I run the code it asks
Enter value for pass:
Instead & is part of string
Thanks in advance
Hello rahulbagal,
one of the solutions is to concatenate the string - i.e.
variable url varchar2;
exec :url := 'http://10.202.12.17:8080/login.asp?user=XYZ' || '&' || 'pass=yzx123';
print url;
url
---------
http://10.202.12.17:8080/login.asp?user=XYZ&pass=yzx123
HTH
I
one of the solutions is to concatenate the string - i.e.
variable url varchar2;
exec :url := 'http://10.202.12.17:8080/login.asp?user=XYZ' || '&' || 'pass=yzx123';
print url;
url
---------
http://10.202.12.17:8080/login.asp?user=XYZ&pass=yzx123
HTH
I
Either set define off
Or set escape off
url := 'http://10.202.12.17:8080/login.asp?user=XYZ\&pass=yzx123';
should work for you
Or set escape off
url := 'http://10.202.12.17:8080/login.asp?user=XYZ\&pass=yzx123';
should work for you
you can also use
set scan off
set scan off
Hi rahulbagal,
you could use
set define off before DECLARE
and
set define on
after END;
regards
I
you could use
set define off before DECLARE
and
set define on
after END;
regards
I
ASKER
Thanks a lot
this works in SQL plus
How can I use it in toad ..
I am planning to execute this code in a trigger
this works in SQL plus
How can I use it in toad ..
I am planning to execute this code in a trigger
rahulbagal
If you are going to use it as a storwed proc or part of a trigger the best solution would be the concant shown above.
If you are going to use it as a storwed proc or part of a trigger the best solution would be the concant shown above.
You can always concat with CHR(38)...
Hi rahulbagal,
escape it with '\&', i.e.
url := 'http://10.202.12.17:8080/login.asp?user=XYZ\&pass=yzx123';
regards
I
escape it with '\&', i.e.
url := 'http://10.202.12.17:8080/login.asp?user=XYZ\&pass=yzx123';
regards
I
>>How can I use it in toad ..
I think that you don't need to do anything in toad for this.
& is just for sql*plus variable.
I think that you don't need to do anything in toad for this.
& is just for sql*plus variable.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot that worked perfectly
Are you running this from SQL Plus? If so you can set the enviroment variables. Try set define off
Thanks