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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Finding non numeric values - sql

Re: Finding non numeric values - sql

From: Matthias Rogel <rogel_at_web.de>
Date: Wed, 20 Nov 2002 07:37:43 +0100
Message-ID: <arfajo$i3q9f$1@ID-86071.news.dfncis.de>


david.garrett wrote:
> I'm trying to find a way to determine if a string holds any non numeric
> characters.
> For instance, I need to use a Decode to do one thing if a string like
> "6706A657987"
> has any non numeric characters and do another if it does not. In this
> example it has an "A" so it would need to be handled differently than say
> "6706657987". I played with Translate a little but it didn't really do the
> trick. Any suggestions?
>
> Any help is greatly appreciated.
>
>

what about

create function holds_non_numeric_characters(s varchar2) return boolean as
begin

    return replace(

           replace(
              replace(
                 replace(
                    replace(
                       replace(
                           replace(
                              replace(
                                 replace(
                                   replace(s, '0'),
                                 '1'),
                              '2'),
                           '3'),
                       '4'),
                    '5'),
                 '6'),
               '7'),
           '8'),
        '9') !=s;

end; Received on Wed Nov 20 2002 - 00:37:43 CST

Original text of this message

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