Re: LOB help!

From: frank <fbortel_at_home.nl>
Date: Tue, 24 Oct 2000 21:10:10 GMT
Message-ID: <39F5F27F.6493AE1B_at_home.nl>


Would that be HTML or URL encoding?
The only reserved characters in HTML are "<", ">", """ and "&". These should be translated to: &lt; &gt; &quot; and &amp; respectively.

Not much trouble with a replace...
URL is a bit more complicated; here's something I use instead of Oracle's OWA coding:

function char_to_hex (p_param in varchar2) return varchar2 IS begin
 return(substr('0123456789ABCDEF',trunc(ascii(p_param)/16)+1,1)||substr('0123456789ABCDEF',mod(ascii(p_param)+1,16),1));

end char_to_hex;

function EscapeUrlParam (p_param in varchar2,

   p_do_reserved in boolean default true)    return varchar2 IS
outstr varchar2(1024) default null;
i number(4) default 1;
c varchar2(1) default null;
begin
  for i in 1 .. length(p_param) loop
 c := substr(p_param,i,1);

  • do NOT translate normal characters if ((c between 'A' and 'Z') OR (c between 'a' and 'z') OR (c between '0' and '9')) then outstr := outstr || c;
  • check on reserved characters, and the need to translate elsif c in (';', '/', '?', ':', '_at_', '=' ,'&') then if p_do_reserved then outstr := outstr ||'%'||char_to_hex(c); else outstr := outstr || c; end if; else
  • translate anything else, 00 - 1F and 7F - FF range included outstr := outstr ||'%'||char_to_hex(c); end if; end loop; return outstr; end escapeUrlParam;

hth, Frank
w wrote:

> I need a function that acts JUST LIKE the "replace" function.
> I have CLOBS that I need to change things like '<' to '&LT'.
>
> I am trying to write it, but if someone else has PLEASE, can you share
> the code? Thank you so much... it is more difficult that it seems!
>
> Thank you
> W
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
  Received on Tue Oct 24 2000 - 23:10:10 CEST

Original text of this message