Solved

SQL Store Procedure Oracle Developer, # between characters

Posted on 2014-03-12
5
543 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 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 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Loading flat file data in tables 2 58
SQL Syntax Grouping Sum question 7 36
Syntax error creating JSON recordset 4 26
Return Rows as per Quantity of Columns Value In SQL 6 27
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Hi, I am very much excited today since I'm going to share something very exciting Tool used for Analytical Reporting and that's nothing but MICROSTRATEGY. Actually there are lot of other tools available in the market for Reporting Such as Co…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

756 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