473,465 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

extract numeric part from address

I am trying to do some analysis on customer's locality, so I'd like to
extract numeric part from address.

Here is how the table looks like

Table Member

first_name last_name address1 address2
state zip
======= ======= =================== ===== === ===
Tom whatever 1200 Evelyn Ave, #121
CA 94102

What I want to do is to write some sql to extract 1200 from Tom's address1.
Can any one give me some hint? Some sample code will be greatly appreciated
!!

David
Jul 19 '05 #1
4 4546
"David Chang" <ch******@yahoo.com> wrote in message news:<8a1Wb.209671$Rc4.1720145@attbi_s54>...
I am trying to do some analysis on customer's locality, so I'd like to
extract numeric part from address.

Here is how the table looks like

Table Member

first_name last_name address1 address2
state zip
======= ======= =================== ===== === ===
Tom whatever 1200 Evelyn Ave, #121
CA 94102

What I want to do is to write some sql to extract 1200 from Tom's address1.
Can any one give me some hint? Some sample code will be greatly appreciated
!!

David


substr(<column>, 1, instr(...) -1 )

You fill in the ... as an exercise.
Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #2
Ron

Hello David,

In case if number always located at the beginning of the filed and space
delimited , you can use below:

select substr(address, 1, instr(address,' ',1) ) from <table>;

If not, then you can use PL/SQL to scrub the address.

Regards,

Ron
DBA Infopower
http://www.dbainfopower.com
Standard disclaimer:
http://www.dbainfopower.com/dbaip_ad...isclaimer.html

"David Chang" <ch******@yahoo.com> wrote in message
news:8a1Wb.209671$Rc4.1720145@attbi_s54...
I am trying to do some analysis on customer's locality, so I'd like to
extract numeric part from address.

Here is how the table looks like

Table Member

first_name last_name address1 address2
state zip
======= ======= =================== ===== === ===
Tom whatever 1200 Evelyn Ave, #121
CA 94102

What I want to do is to write some sql to extract 1200 from Tom's address1. Can any one give me some hint? Some sample code will be greatly appreciated !!

David

Jul 19 '05 #3
"Ron" <su*****@dbainfopower.com> wrote in message news:<uJ********************@comcast.com>...
Hello David,

In case if number always located at the beginning of the filed and space
delimited , you can use below:

select substr(address, 1, instr(address,' ',1) ) from <table>;

If not, then you can use PL/SQL to scrub the address.

Regards,

Ron
DBA Infopower
http://www.dbainfopower.com
Standard disclaimer:
http://www.dbainfopower.com/dbaip_ad...isclaimer.html

"David Chang" <ch******@yahoo.com> wrote in message
news:8a1Wb.209671$Rc4.1720145@attbi_s54...
I am trying to do some analysis on customer's locality, so I'd like to
extract numeric part from address.

Here is how the table looks like

Table Member

first_name last_name address1 address2
state zip
======= ======= =================== ===== === ===
Tom whatever 1200 Evelyn Ave, #121
CA 94102

What I want to do is to write some sql to extract 1200 from Tom's

address1.
Can any one give me some hint? Some sample code will be greatly

appreciated
!!

David


Due to the basic nature of the OP's request:
please try to learn people how to fish, do not fish on their behalf.
You are disclosing way too much. OP should *learn* sql, he should not be spoon fed.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #4
Assuming we only have 1 space between the street number and the name of the
street I would try this

SELECT SUBSTR(ADDRESS, INSTR(ADDRESS,' ',1)) FROM <TABLE>

The examle below would return the number part.

If you wanted to be sure you might have to resort to PL/SQL if there are
more that 1 space.

J.



<sy******@yahoo.com> wrote in message
news:a1**************************@posting.google.c om...
"Ron" <su*****@dbainfopower.com> wrote in message news:<uJ********************@comcast.com>...
Hello David,

In case if number always located at the beginning of the filed and space delimited , you can use below:

select substr(address, 1, instr(address,' ',1) ) from <table>;

If not, then you can use PL/SQL to scrub the address.

Regards,

Ron
DBA Infopower
http://www.dbainfopower.com
Standard disclaimer:
http://www.dbainfopower.com/dbaip_ad...isclaimer.html

"David Chang" <ch******@yahoo.com> wrote in message
news:8a1Wb.209671$Rc4.1720145@attbi_s54...
I am trying to do some analysis on customer's locality, so I'd like to
extract numeric part from address.

Here is how the table looks like

Table Member

first_name last_name address1 address2 state zip
======= ======= =================== ===== === ===
Tom whatever 1200 Evelyn Ave, #121
CA 94102

What I want to do is to write some sql to extract 1200 from Tom's

address1.
Can any one give me some hint? Some sample code will be greatly

appreciated
!!

David


Due to the basic nature of the OP's request:
please try to learn people how to fish, do not fish on their behalf.
You are disclosing way too much. OP should *learn* sql, he should not be

spoon fed.
Sybrand Bakker
Senior Oracle DBA

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bernard Drolet | last post by:
Hi, I have a column containing a string; the string always starts with a letter (a-z), followed by an undefined number of letters, then one number or more. The REGEXP would look like *+ I...
3
by: Joe | last post by:
I'm trying to extract part of html code from a tag to a tag code begins with <span class="boldyellow"><B><U> and ends with TD><TD> <img src="http://whatever/some.gif"> </TD></TR></TABLE> I was...
44
by: RB | last post by:
How to extract bytes from long, starting from the last byte? For example, I have a long number: 0x12345678 I need to represent it as the following bytes list: 0x78, 0x56, 0x34, 0x12 Thanks in...
3
by: zek2005 | last post by:
Hi friends! I have a varchar field in my DB with numeric values separates by spaces. I need to extract the numbers to create an array. Example 1: 1820 1823 1825 --> need to be transform into ...
8
by: Fabian Braennstroem | last post by:
Hi, I would like to remove certain lines from a log files. I had some sed/awk scripts for this, but now, I want to use python with its re module for this task. Actually, I have two different...
3
by: gmazza via AccessMonster.com | last post by:
Hi there, I am trying to run a report using a parameter for where the user chooses a month from a combo box. Then on the report, I want it to compare the month to a date field and choose only...
4
by: David Chang | last post by:
I am trying to do some analysis on customer's locality, so I'd like to extract numeric part from address. Here is how the table looks like Table Member first_name last_name address1 ...
18
by: Ecka | last post by:
Hi everyone, I'm trying to write a PHP script that connects to a bank's currency convertor page using cURL and that part works fine. The issue is that I end up with a page that includes a lot...
4
code green
by: code green | last post by:
I have a text field called notes in which users have typed almost anything they like. I need to find numeric data randomly inserted in there. So for example there may be a telephone number and an...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.