Re: SQL Select Query with String Manipulation

From: Andrew Cox <a7t2fz001_at_sneakemail.com>
Date: 28 Oct 2002 05:52:35 -0800
Message-ID: <c40fc812.0210280552.1afc46f4_at_posting.google.com>


afilonov_at_yahoo.com (Alex Filonov) wrote in message news:<336da121.0210250747.6a39247d_at_posting.google.com>...
> a7t2fz001_at_sneakemail.com (Andrew Cox) wrote in message news:<c40fc812.0210241337.76edb331_at_posting.google.com>...
> > Hi,
> >
> > I'm trying to do a little string manipulatin within a SQL Select
> > statement and I'm not sure if it's possible or not. Here's the type
> > of data that I have in the field I'm concerned with:
> >
> > DESCR:
> > ------
> > 02 A code with description
> > 24 Some description here
> > 42 Another Description here
> > A description without a corresponding code
> > Another description without a code
> >
> > Okay ... what I want to do is strip the number codes from the
> > descriptions that have them *within* the SQL Select query. I need to
> > do it within the query because of other constraints (I have to pass
> > the whole query to a ColdFusion custom tag). The problem as I see it
> > is that not all of the fields will have the leading code (though most
> > of them do).
> >
> > Is it possible to do that kind of string manipulation within the
> > SELECT statement?
>
> Here's the example:
>
> 1 select
> 2 ltrim('02 Message 01', '012345679 ')
> 3* from dual
> SQL> /
>
> LTRIM('02M
> ----------
> Message 01
>

Awesome - that worked great. Thank you very much.

Andrew Received on Mon Oct 28 2002 - 14:52:35 CET

Original text of this message