Computing.Net > Forums > Database > Reading a part of a string in SQL

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Reading a part of a string in SQL

Reply to Message Icon

Name: novice82
Date: August 4, 2009 at 21:03:32 Pacific
OS: Windows XP
Subcategory: General
Tags: Oracle 10g
Comment:

I have a table with one column " otname "
table1.otname contains multiple rows of alpha-numeric string resembling the following data sample:

11.10.32.12.U.A.F.3.2.21.249.1
2001.1.1003.8281.A.LE.P.P
2010.1.1003.8261.A.LE.B.B

I want to read the fourth number in every string ( part of the string in bold ) and write a query in Oracle 10g
to read its description stored in another table. My dilemma is writing the first part of the query.i.e. choosing the fourth number of every string in a table

My second query will be something like this:

select description_text from table2 where sncode = 8281 -- fourth part of the data sample in every string

Many thanks.

novice



Sponsored Link
Ads by Google

Response Number 1
Name: jon_k
Date: August 11, 2009 at 00:19:59 Pacific
Reply:

Apologies it's not an exact answer: I can only speak from
MySQL experience but you may be able to find something
equivalent in oracle:

SELECT 
SUBSTRING_INDEX(SUBSTRING_INDEX(fieldname, '.', 4), '.', -
1)

Alias this and you can use it in your "WHERE" clause


0
Reply to Message Icon

Related Posts

See More


Problem in inserting valu... Data synchronization betw...


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Reading a part of a string in SQL

Problem in inserting values to a table in SQL www.computing.net/answers/dbase/problem-in-inserting-values-to-a-table-in-sql/710.html

Replacing part of a hyperlink www.computing.net/answers/dbase/replacing-part-of-a-hyperlink/514.html

Reading a .bas file in VB 2005 www.computing.net/answers/dbase/reading-a-bas-file-in-vb-2005/467.html