remove html tag plsql
scott@9i > select text from user_source where name='STR_HTML';
TEXT
----------------------------------------------------------------------------------------------------
function str_html ( line in varchar2 )
return varchar2 is
x       varchar2(32767) := null;
in_html boolean         := FALSE;
s       varchar2(1);
Begin
    if line is null then
      return line;
    end if;
    for i in 1 .. length( line ) loop
      s := substr( line, i, 1 );
      if in_html then
        if s = '>' then
          in_html := FALSE;
        end if;
      else
        if s = '<' then
          in_html := TRUE;
        end if;
      end if;
      if not in_html and s != '>' then
        x := x || s;
      end if;
    end loop;
    return x;
  end str_html;
26 rows selected.
  1  select ('<h1>this is heading </h1> <body> this is body </body>')||chr(10)||
  2         str_html('<h1>this is heading </h1> <body> this is body </body>')
  3* from dual
scott@9i > /
('<H1>THISISHEADING</H1><BODY>THISISBODY</BODY>')||CHR(10)||STR_HTML('<H1>THISISHEADING</H1><BODY>TH
----------------------------------------------------------------------------------------------------
<h1>this is heading </h1> <body> this is body </body>
this is heading   this is body
 
 
ليست هناك تعليقات:
إرسال تعليق