Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL Store Procedure Oracle Developer, # between characters

Posted on 2014-03-12
5
Medium Priority
?
553 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
[X]
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
  • 2
5 Comments
 
LVL 41

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 2000 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

Amazon Web Services EC2 Cheat Sheet

AWS EC2 is a core part of AWS’s cloud platform, allowing users to spin up virtual machines for a variety of tasks; however, EC2’s offerings can be overwhelming. Learn the basics with our new AWS cheat sheet – this time on EC2!

Question has a verified solution.

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

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

670 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