Home » SQL & PL/SQL » SQL & PL/SQL » ZIPCODE ISSUES with query
ZIPCODE ISSUES with query [message #225007] Fri, 16 March 2007 09:13 Go to next message
dimples0109
Messages: 6
Registered: March 2007
Junior Member
I am writing a query and I am having trouble with the zipcode, I need to put the results in a flat file, and I need the zipcode column to only be 5 digits, but some of the zips have five digit with a dash(-). 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.


In the same field we have the following
5 digit zip
12345
6 digit zip
12345-

Re: ZIPCODE ISSUES with query [message #225008 is a reply to message #225007] Fri, 16 March 2007 09:17 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Try
REPLACE(zip_code,'-','')
for displaying the field. = 5[/CODE]
Re: ZIPCODE ISSUES with query [message #225009 is a reply to message #225008] Fri, 16 March 2007 09:25 Go to previous message
dimples0109
Messages: 6
Registered: March 2007
Junior Member
THANK YOU! I was wondering if you could give some advice on a good sql or sqlplus book that gives great examples. I have read a few and not getting the info I need. Like I am reading some of the Oreily books and they discuss replace but dont really tell you how you can use it, or only give one example.

Razz Razz Razz
Previous Topic: Trigger not working.
Next Topic: Lost my column headings
Goto Forum:
  


Current Time: Sun Dec 11 00:26:15 CST 2016

Total time taken to generate the page: 0.03844 seconds