Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Finding non numeric values - sql
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;
![]() |
![]() |