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: select only numeric value from varchar2 column

Re: select only numeric value from varchar2 column

From: Maiko <maiko_at_dds.nl>
Date: Tue, 20 Jul 1999 08:50:15 GMT
Message-ID: <379936ad.12251326@news.cistron.nl>


I think this can be done through PL/SQL

create or replace function selnum(kol1 varchar2) return number as  i number;
 ret boolean;
BEGIN
  ret := true;
  i:=1;
  while (i<=length(kol1) and ret=true) loop     if (ascii(substr(kol1),i,1) < 48 or

       ascii(substr(kol1),i,1) > 57)
  then ret:=false; end if;
  i:=i+1;
  end loop;
  if ret then return(kol1) else
   return(null);
 end if;
END; in SQL: select selnum(col1) from <yourtable>

On Tue, 20 Jul 1999 10:00:50 +0200, Bruno Decraene <bdecraene_at_atos-group.com> wrote:

>I have a table toto with varchar column col1
>
>col1 contains alphanumeric values and numeric values and i want to
>select only the numeric values
>
>How can i do this
>
>Thank you
>
>ansewer to me to rchennaa_at_atos-group.com
>
>Rach
>
>
Received on Tue Jul 20 1999 - 03:50:15 CDT

Original text of this message

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