Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL, Oracle Web App Server - HELP!

Re: PL/SQL, Oracle Web App Server - HELP!

From: Igor Keselman <keselman_at_cle.ab.com>
Date: Tue, 25 Aug 1998 11:15:43 -0400
Message-ID: <35E2D51F.1C42DEE@cle.ab.com>


I'm afraid the quotes won't work. White space is not allowed character for the URL name. It has to be escaped with "+" sign. So in this case it would be: Url?var1=abc+123&var2=this+will+work. You don't have to worry about decoding the variables - web server will take care of it.
Note that there are more characters that need to be escaped in the URL line ('+','&','%',etc.). These has to be replaced by the "%hh" sequence where hh is the ascii value of the character in hex. I wrote a function that encodes any string into URL friendly format. If you want you can use it to build your parameter strings.

  /********************************************/
  /* Function to encode string for GET method */
  /********************************************/
  function url_encode(p_str in varchar2 default null) return varchar2 is     ch varchar2(1);
    strLen number;
    curChar number;
    result varchar2(2000):=null;
    temp varchar2(10);
  begin
    strLen:=length(p_str);
    for curChar in 1..strLen loop
      ch:=substr(p_str,curChar,1);
      if (ch>='a' and ch<='z') or (ch>='A' and ch<='Z') or (ch>='0' and
ch<='9') or 
          ch='_' or ch='.' or ch='-' or ch='*' then 
        result:=result || ch;
      elsif ch=' ' then
        result:=result || '+';
      else
        select rawtohex(ch) into temp from dual;
        result:=result || '%' || temp;
      end if;

    end loop;
    return result;
  exception
    when others then
      return p_str;
  end;

Prasad Chavali wrote:
>
> You need to include a single quote for the variable with spaces.
>
> For eg:
>
> Url?var1='abc 123'&var2=nothing will work.
>
> HTH
> Prasad Chavali
> Russell Fray wrote in message <35dd731b.863705310_at_news.u-net.com>...
> >
> >I need to pass some variables in to a procedure from a URL.
> >
> >I am using Send variable
> >
> >This works fine, unless I have spaces within the variable. Ie, if I
> >want to send 'abc 123' I get the error 'invalid syntax'. If I use
> >'abc123' it works fine.
> >
> >How can I send spaces??
> >
> >If I use a GET form, it works fine, but I need to be able to use URL
> >line variables.
> >
> >Please cc replies to russ_at_u-net.net
> >
> >Thanks,
> >Russ.
> >
Received on Tue Aug 25 1998 - 10:15:43 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US