Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help another zipcode delimma
On Mar 15, 4:50 pm, DA Morgan <damor..._at_psoug.org> wrote:
> anitra_tan..._at_yahoo.com wrote:
> > Thanks for the help on the previous question but now I have been
> > presented with the following issue.
>
> > In the same field we have 3 different scenarios
>
> > 5 digit zip
> > 12345
>
> > 6 digit zip
> > 12345-
>
> > 10 digit zip
> > 12345-1311
>
> > I want to say give me all the zips that are 5 and 6 digits and where
> > there is a 6 digit, dont show the
> > dash (-). so when my query runs they will all look like 5 digit
> > zips. I have made a seprate query for the 10 digit.
>
> > previously I used length(zip) = 5
>
> Think about using DECODE or CASE or Regular Expressions. There are
> probably a dozen ways, some with LENGTH, to solve the problem.
> --
> Daniel A. Morgan
> University of Washington
> damor..._at_x.washington.edu
> (replace x with u to respond)
> Puget Sound Oracle Users Groupwww.psoug.org- Hide quoted text -
>
> - Show quoted text -
You can find the CASE statement and the DECODE function along with the (hint) SUBSTR function defined in the Oracle SQL manual. The manuals are available online at http://tahiti.oracle.com .
HTH -- Mark D Powell -- Received on Fri Mar 16 2007 - 09:24:01 CDT
![]() |
![]() |