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: Is_number () like function

Re: Is_number () like function

From: Alan D. Mills <alanmNOSPAM_at_uk.europe.mcd.mot.com>
Date: Tue, 21 Jul 1998 14:19:58 +0100
Message-ID: <6p24ib$9ti$1@schbbs.mot.com>


I've used the TRANSLATE function to do this before.

Use the translate function to convert your column value by translating each digit character to a '0' (zero), say. You might want to include the decimal point character also.

Afetr doing this, your varchar2 values say '1234', '45.345' and 'My IQ IS 150' would have been translated to the strings '0000', '000000' and 'My IQ IS 000' respectively. If you then RPAD the result to a suitable known length (say ten) you could compare the final result against a string of ten 0's. If it matches then it was a number. If it didn't match then it doesn't represent a number.

--
Alan D. Mills

Christophe Renard wrote in message <6p1pc4$ec4$1_at_supernews.com>...
>I was wondering (and did not found in the documentation), if PL/SQL has a
>function that would give me all the rows where myfield is a varchar2
describing a
>valid number.
Received on Tue Jul 21 1998 - 08:19:58 CDT

Original text of this message

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