Solved

SQL Store Procedure Oracle Developer, # between characters

Posted on 2014-03-12
5
533 Views
Last Modified: 2014-03-13
I have a field with numbers separated by ":" the problem is that I would it also contains other numbers.  I need just the 15 digit numbers within the semi colons.  An example of what is in the field is  :1571144410824900.000000:  I just need the 1571144410824900, the 16 digit number.  A field might have :1312710607045440.000000:1571144410824900.000000: but I just need the 16 digit numbers before the semi colons.  I main will be only one 16 digit number but I am just.  Can you help.  The Name of the field is Booklist.
0
Comment
Question by:trinisunset
  • 2
5 Comments
 
LVL 40

Expert Comment

by:Sharath
Comment Utility
The question is in Oracle and SQL Server 2005. What is your database?
0
 
LVL 73

Expert Comment

by:sdstuber
Comment Utility
>> A field might have :1312710607045440.000000:1571144410824900.000000: but I just need the 16 digit numbers before the semi colons.

Which one is that? they are both between semicolons and hence both before at least one semicolon.

Also, your description says 15 digits and 16 digits but your values are 22 digits.
0
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
Comment Utility
Assuming you want the first 16 digit (but possibly followed by zeros) value that is between semicolons then try this on Oracle 11.2 or higher.


REGEXP_SUBSTR(
           booklist,
           ':([0-9]{16})(\.0*)?:',
           1,
           1,
           NULL,
           1
       )

If your version is 10.1 or higher you can nest the regexp inside a substr to get the subexpression

SUBSTR(REGEXP_SUBSTR(booklist, ':([0-9]{16})(\.0*)?:'), 2, 16)
0
 

Author Closing Comment

by:trinisunset
Comment Utility
Thank you this SUBSTR(REGEXP_SUBSTR(booklist, ':([0-9]{16})(\.0*)?:'), 2, 16)  worked.  Thank you, thank you!!!!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Hello, In my precious Article  (http://www.experts-exchange.com/Database/Reporting/A_15280-Create-Project-in-Microstrategy-Part-I.html)we saw the Configuration part for Microstrategy which included Metadata Creation and DataSource Preparation as …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now