Re: Return first number in a string

From: KVN Chary <kvnchary_at_yahoo.com>
Date: 14 Feb 2003 09:15:43 -0800
Message-ID: <b6ec1ff3.0302140915.7e31258_at_posting.google.com>


Try this:

select replace(translate('&in_value',
  'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!~_at_#$%^&*()-_=;:"></?',

 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'),'X')
from dual;

Chary

Svend Jensen <svend.jensen_at_it.dk> wrote in message news:<3E495415.5050308_at_it.dk>...
> Check the article, the power of decode.
> /Svend Jensen
>
> GP wrote:
> > What's the easiest way to return the number component of a string
> > where the string always starts with a number when it's a meaningful
> > value. Can I do it within a select statement, or do I need something
> > like a stored function?
> >
> > Example
> >
> > 90% should return 90
> > 90 and rising should return 90
> > Ordered in Error should return 0 or null
> >
> > Appreciate thoughts....
Received on Fri Feb 14 2003 - 18:15:43 CET

Original text of this message