Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SQL Store Procedure Oracle Developer, # between characters

Posted on 2014-03-12
5
542 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
ID: 39925653
The question is in Oracle and SQL Server 2005. What is your database?
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 39926087
>> 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 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 39926096
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
ID: 39926248
Thank you this SUBSTR(REGEXP_SUBSTR(booklist, ':([0-9]{16})(\.0*)?:'), 2, 16)  worked.  Thank you, thank you!!!!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

791 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