'Using host command to call a url with parameters in Oracle forms

I am using Forms [32 Bit] Version 6.0.8.26.0

Within a Oracle Forms trigger I am using the host command to call a url with parameters. An example of this part of my code is below:

HOST('cmd /c start http://localhost/TestServlet?p1=A&p2=B');

but the browser is invoked with output url that is showing till the ampersand sign and stops:

http://localhost/TestServlet?p1=A

Any suggestions on how to get the full url using the HOST command from oracle forms



Solution 1:[1]

You can replace & with %26 inside URL

Solution 2:[2]

& is used to separate commands. Therefore we can use ^ to escape the &

Solution 3:[3]

replace spaces by %20 and use ^&

Solution 4:[4]

Try losing the "cmd /c".

This worked for me:

PROCEDURE call_url_from_forms6i(i_user_id           varchar2
                               ,i_section_id        varchar2) is
  /* http://stackoverflow.com/questions/15320620/using-host-command-to-call-a-url-with-parameters-in-oracle-forms */                               
  p_user_id      varchar2(200) := '&P_USER_ID='||nvl(i_user_id,'1');
  p_section_id   varchar2(200) := '&P_SECTION_ID='||nvl(i_section_id, '0');
  p_report_name  varchar2(200) := '&report_name=REPNAME';  
  p_url         varchar2(200) := 'http://website.com/folder/';
  v_servlet_name varchar2(200) := 'servletname?';
  p_report       varchar2(200) := 'report=REPORT';    
  p_url_hdr      varchar2(200) := p_url||v_servlet_name;
  p_url_params   varchar2(2000);
  p_url_host_call varchar2(2000);
BEGIN
  p_url_params := p_report||p_user_id||p_section_id||p_report_name;
  --display in browser
  p_url_host_call := 'start "" "'||p_url_hdr||p_url_params||'"';
  host(p_url_host_call);
EXCEPTION 
  WHEN OTHERS THEN
    --message('Error running report in browser: '||sqlerrm);pause;
    return;
END;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Egor Skriptunoff
Solution 2 user2079954
Solution 3 aishana
Solution 4 moe