Looking for 6 numbers on a line in a varchar column

The database is Oracle 9 so I can't use regular expressions. :( I have a column varchar2 with long string as inputs:


COLUMN_X
--------------------------------------------------------------------------------------------------------
Stuff/stuff_start1.4_yes_208336_why_1.0_D9
more_stuff / running_start_env_208398_wonder_2.0_D98
yetmore_stuff2.9/workistedious_start_wordup_256336_why_1.7_D98658
yetmore_stuff/workistediouswordy_256336_I_am_green



I need to get out just the number series when there are 6 numbers in a row so I can them are aligned with the other rows in the table with the same 6 digits. If I shoot only numbers I sometimes get too many numbers, and it is also possible that I don't want numbers will appear before or after the 6 figures I'm after. How can I select according to the COLUMN_X data above and get only the numeric characters when there is 6 of them in order?

COLUMN_X
___________
208336
208398
256336
256336



CREATE TABLE dt_test (COLUMN_X varchar2 (50))
/

insert into dt_test values ('stuff/stuff_start1.4_yes_208336_why_1.0_D9')
/
insert into dt_test values ('more_stuff / running_start_env_208398_wonder_2.0_D98')
/
insert into dt_test values ('yetmore_stuff2.9/workistedious_start_wordup_256336_why_1.7_D98658')
/
insert into dt_test values (' yetmore_stuff/workwordy_256336_I_am_green')
/

Thanks in advance

The database is Oracle 9 so I can't use regular expressions.

You can with owa_pattern ;)

You can create a function and use it as

SQL> create or replace function match (line varchar2, pat varchar2, flags varchar2 default null)
   return sys.dbms_debug_vc2coll
   pipelined
as
   b              boolean;
   backrefs       owa_text.vc_arr;
   r              sys.dbms_debug_vc2coll;
begin
   b   := owa_pattern.match (line, pat, backrefs, flags);

   for i in 1 .. backrefs.count
   loop
      pipe row (backrefs (i));
   end loop;

   return;
end match;
/
Function created.

SQL> select * from dt_test, table (match (column_x, '(\d{6})'))
/
COLUMN_X                                                               COLUMN_VALUE
---------------------------------------------------------------------- ------------------------------
stuff/stuff_start1.4_yes_208336_why_1.0_D9                             208336
more_stuff/running_start_env_208398_wonder_2.0_D98                     208398
yetmore_stuff2.9/workistedious_start_wordup_256336_why_1.7_D98658      256336
yetmore_stuff/workwordy_256336_I_am_green                              256336                        

4 rows selected.

Tags: Database

Similar Questions

  • Numbering of the lines based on two columns

    Hello world

    I´d would like to know if there is a way to achieve the numbering shown in the second table below indicating only Oracle native functions, like ROW_COUNT() on the partition, etc.

    I m using Oracle 10 g.

    The logic used is:
    From 1, increment one each time that the ORIGIN is identical to the FIRST ORIGIN of the line (ID) group.
    ID    ORIGIN    DESTINATION    ORDER
    ------------------------------------
    1     A         B              1
    1     B         A              2
    1     A         B              3
    1     B         C              4
    1     C         A              5
     
    ID     ORIGIN    DESTINATION    ORDER    NUMBERING
    --------------------------------------------------
    1      A         B              1        1
    1      B         A              2        1
    1      A         B              3        2
    1      B         C              4        2
    1      C         A              5        2
    In order to compare the ORIGIN of each line with the FIRST ORIGIN of the group, I used the function LAG to create a column that will be the FIRST ORIGIN of the value in the group.

    However, I was not able to number the lines as shown above (column NUMBERING).

    Any help will be much appreciated.

    --------------------------------------------------------------------------------------------------------------

    Test query:
    WITH T AS
    (
      SELECT 1 ID, 'A' ORIGIN, 'B' DESTINATION, 1 ORDERING FROM DUAL UNION ALL
      SELECT 1 ID, 'B' ORIGIN, 'A' DESTINATION, 2 ORDERING FROM DUAL UNION ALL
      SELECT 1 ID, 'A' ORIGIN, 'B' DESTINATION, 3 ORDERING FROM DUAL UNION ALL
      SELECT 1 ID, 'B' ORIGIN, 'C' DESTINATION, 4 ORDERING FROM DUAL UNION ALL
      SELECT 1 ID, 'C' ORIGIN, 'A' DESTINATION, 5 ORDERING FROM DUAL
    )
      SELECT T.ID
           , T.ORIGIN
           , T.DESTINATION
           , T.ORDERING
           , LAG (T.ORIGIN, T.ORDERING -1, 0) OVER (PARTITION BY T.ID
                                                        ORDER BY T.ID
                                                               , T.ORDERING) FIRST_ORIGIN_OF_GROUP
        FROM T
    ORDER BY T.ID
           , T.ORDERING

    Hello

    Here's one way:

    WITH     got_first_origin     AS
    (
         SELECT     id, origin, destination, ordering
         ,     FIRST_VALUE (origin) OVER ( PARTITION BY  id
                                          ORDER BY         ordering
                                     ) AS first_origin
         FROM    t
    )
    SELECT     id, origin, destination, ordering
    ,     COUNT ( CASE
                        WHEN  origin = first_origin
                  THEN  1
                    END
               )     OVER ( PARTITION BY  id
                           ORDER BY      ordering
                   ) AS numbering
    FROM     got_first_origin
    ;
    

    This assumes that the combination of id and order is unique. Within an id, you place your order does not have to be consecutive integers, or something like that.

    Analytical functions cannot be nested (the argument of the function of COUNTY anlytic can not call the analytical FIRST_VALUE function); The subquery is necessary.
    You could do something with a LAG, as you have tried, rather than FIRST_VALUE, but you would still need a subquery, for the same reason.

  • Look for the microphone device using line to windows vista Home premium

    What are the steps to locate a device lin - into the microphone, the axis of the microphone Jack. ? and I can say that the system automatically locate?

    Hello

    Your question does contain all the required information necessary for us to help you. Please include more information to continue troubleshooting as a result.

    For instructions, see Help for Suggestions for a question on forums

    In the meantime, see:

    Connect one microphone, music player or other audio device to your computer

  • I'm looking for wheter cursor returns a line any?

    Dear gurus
    How do I intercept that is a slider, recovered in a loop, or is any line not as when No_Data_Found does not work with cursors. Should I write the select statement in the cursor again in the Begin block to check its output? or is there any other integrated short?

    kamranpathan wrote:

    .. but one thing confused me it is what happens if I am selecting data in multiple tables in my cursor, so how can I map a TABLE TYPE to these data? and how do I assign this slider values to variables in a loop, please specify this to completely solve my problem.

    I don't completely understand the problem... a cursor SELECT outputs a projection of SQL. This data structure is defined by the column, the column data types and order of the columns being selected.

    The best way to deal with this is to simply define a data type for a projection of this SQL cursor and use it as an extraction buffer. For example

    declare
      cursor c is select ..... ;  -// can do multiple joins and project basically anything
    
      type TBuffer is table of c%RowType; --// we define a data structure to receive the cursor's output
    
      buffer TBuffer; --// lastly we define the collection variable to bulk process the cursor's output
    begin
     ...
    end;
    

    If you do an outer join, you can simply check one of the columns of the table of the outer join to determine if this table provided the data in this row or not.

    If you want logical data structures in your code to deal with the projection of SQL, you can create SQL data types that define these data - structures in the selection, you can simply use these types to create the structures of logical data for you.

    A simple example:

    SQL> --// a logical data structure for our code on table 1
    SQL> create or replace type TTableRow is object(
      2          table_name      varchar2(30),
      3          tablespace_name varchar2(30)
      4  );
      5  /
    
    Type created.
    
    SQL>
    SQL>
    SQL> --// a logical data structure for our code on table 2
    SQL> create or replace type TObjectRow is object(
      2          object_type     varchar2(19),
      3          object_name     varchar2(128)
      4  );
      5  /
    
    Type created.
    
    SQL>
    SQL> --// create collection types for these structures
    SQL> create or replace type TTableRowList as table of TTableRow;
      2  /
    
    Type created.
    
    SQL> create or replace type TObjectRowList as table of TObjectRow;
      2  /
    
    Type created.
    
    SQL>
    SQL>
    SQL>
    SQL> declare
      2          cursor c is
      3                  select
      4                          TObjectRow( o.object_type, o.object_name ),
      5                          TTableRow( t.table_name, t.tablespace_name )
      6                  from    user_objects o,
      7                          user_tables t
      8                  where   o.object_type = 'TABLE'
      9                  and     o.object_name = t.table_name (+)
     10                  order by o.object_name;
     11
     12          objData TObjectRowList;
     13          rowData TTableRowList;
     14  begin
     15          open c;
     16          loop
     17                  fetch c bulk collect into objData, rowData limit 100;
     18
     19                  --// we can now process these logical data strutures output by the
     20                  --// cursor separately from one another
     21                  for i in 1..objData.Count
     22                  loop
     23                          --// use the the 1st logical structure
     24                          DBMS_OUTPUT.put( 'Table: '||objData(i).object_name||chr(09) );
     25
     26                          --// use the 2nd logical structure
     27                          if rowData(i).table_name is null then
     28                                  DBMS_OUTPUT.put_line( 'This table is an object table. No data found in USER_TABLES.' );
     29                          else
     30                                  DBMS_OUTPUT.put_line( 'This table is a normal table. Data found in USER_TABLES.' );
     31                          end if;
     32                  end loop;
     33
     34                  exit when c%NotFound;
     35
     36          end loop;
     37          close c;
     38  end;
     39  /
    Table: PIVOTTAB This table is a normal table. Data found in USER_TABLES.
    Table: POINTS   This table is an object table. No data found in USER_TABLES.
    Table: SALES    This table is a normal table. Data found in USER_TABLES.
    Table: TESTTAB  This table is a normal table. Data found in USER_TABLES.
    Table: XML_DOC  This table is a normal table. Data found in USER_TABLES.
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • Looking for workflow contain one invoice line

    We have a reserved sales order. We want to add a single line of Bill on the agenda. The element we add is available but we want that it will charge when certain lines in the sales order are met. The idea is to add the line to a realization set to keep billing. But the problem is that right before we try to add the line across the realization, it is automatically saved and progresses to fufilled.

    We are on 11.5.9. Does anyone know of a seeded workflow (or other method) that can be used to maintain the law alone line just long enough to get across the achievement?

    -Tracy

    Tracy
    Unfortunately the database I checked is extended with the fulfill postponed in it (they customized the original line type). I checked the vision, he's not here. So the only option is to extend the workflow. Also I personally are not the deferred option. The reason is, as you have planned for every five minutes, there is no way we can enter the command against the background of start-up line. There may be cases where, soon, I walked in the line, WBG began and pushed, even before I have finished my work.

    Thank you
    Claire

  • Looking for an explanation to a line in a script of dataProvider

    Hello

    I play with the DataGrid in flash... Here t is the code I use to fill the 2 lines of code:

    Import fl.data.DataProvider;
    var myData:DataProvider = new DataProvider();
    myData.addItem ({team: "dallas", won: 1, lost: 105, p: 0,817});
    myData.addItem ({team: wins: 20, 'Giants' to cent: 0,817 losses: 5});
    myDG.dataProvider = myData;

    My question is:

    Can someone explain to me why the D in DataProvider is crucial everywhere in the script, but the last line, where there must be a tiny d work?

    Thank you

    Babs

    The captialized DataProvider is a class name, used to create a new instance of an object (myData) DataProvider.   The tiny dataProvider is a property of the data grid that defines what is used to provide its data.

  • The HD on Thinkpad T430 upgrade, how can I find a compatible drive? Looking for 1 TB 7200 RPM

    Hi, I recently got a T430 renovated and well, I just love and want to invest in an upgrade to 1 TB hard drive 7200 RPM

    I read the specs here but other than:

    • High, 320 GB, 7200 RPM, SATA 3.0 GB/s 7mm
    • 500 GB, 7200 RPM, 7mm or 9.5 mm high SATA 3.0 GB/s
    • 1 TB, 5400 RPM, 9.5 mm high SATA 3.0 GB/s

    It is really not a lot to spend when buying a new hard drive. (totall rookie at this, so please be nice)

    Are all HDDs OTC market you today my machine? I have read discussions on the Bay in my entirely appropriate machine HDs 7 mm and 9.5 is a stretch and could adversely affect the connection to the motherboard. You can link me to a schematic page? I am looking for part numbers, which would help.

    Here are some HDs I consider, how do I know if they will fit ok? Comments are appreciated. I can watch videos on gootube how swap, this part is easy.

    Currently dual boot win 7 pro and ubuntu 14.04 and I've pretty much mukked to the top of the 320 hd with partitions before I knew any better. Nothing on the drive is special, I might as well do a clean install or restore backups. Which do you recommend?

    I would replace the hd in 9.5 mm slot?

    PS, none of the disks hybrid work in the T430?

    Thank you!

    Good day and welcome to the community.

    For reference, take a look at the FRU T430 parts list: https://download.lenovo.com/parts/ThinkPad/t430_t430i_fru_bom_20140722.pdf

    There is a section for each: 7 mm/2.5 "" SSD and 7 & 9.5mm/2.5 ' hard drives, which were offered with the machine. "

    Hope this helps your search a little.

    Kind regards.

  • I'm looking for documentation on the Firefox command line arguments.

    I'm looking for documentation on the Firefox command line arguments. I use Ubuntu.

    http://KB.mozillazine.org/Command_line_arguments

    This doesn't seem to be what you're looking for?

  • How to select id when same id has several lines, but I'm looking for ideas lacking a particular value

    I have this my_table_c in the table with the values below

    SELECT * FROM my_table_c
    ID GROUP_ID GROUP_VALUE
    121
    332
    341
    541
    521
    222
    232
    241

    I'm looking for this output where to get only the ID that did not have group_id 2. Besides, I don't want to get the ID where group_id 2 is missing, but the other group IDS are present.

    Group_id if 2 is absent, it is my target id.

    So with the values indicated in the table above, I expect just ID = 3 or returned as other lines ID 1, 2 and 5 have each where group_id = 2.

    Can someone please help with a query to retrieve this result.

    Select *.
    Of
    (
    SELECT id, group_id, group_value, count (case when group_id = END 2 then 1) over (partition by id) as cnt
    of my_table_c
    ) where cnt = 0

  • Looking for some practice files for video in line/book of "Adobe Photoshop CS5 Extended: Essentials. I use the tutorial via membership in Safari book online and the files are not available on Safari.  Do you know where I can get the files?

    Looking for some practice files for video in line/book of "Adobe Photoshop CS5 Extended: Essentials. I use the tutorial via membership in Safari book online and the files are not available on Safari.  Do you know where I can get the files?

    Looks like the manufacturer was "Total Training. I can't find the title to Adobe.com

    http://totaltraining.com/store/Photoshop-CS5-extended-Essentials/

  • Looking for numbers of HARD drive

    Hi guys,.

    I do a lot of service for hp printers and their two especially one in particular that we have a lot of problem hard drive with the ch 3035 that come with that disk hard western digtial blue. I am looking for the part number for the black western Digital hard drive replacement, as well as I've not stumbled on any question, I know I want to have one on hand I can't find a spare hard drive part number for the hp laserjet 500 m525.

    I think what you want is CF116-67907.

    As soon as the Page 170 of repair:

    Table 2-3 clients auto-repair (CSR) and repair kits (suites)

    Number of part article

    USB control panel cover 5042-8977

    Kit Moss-reflector

    Foam reflector ●

    Installation instruction ●

    5851 4878

    Carpet Kit spring separation

    Spring ● separation pad

    Installation instruction ●

    5851 4879

    Transistorized module SSM Kit

    Module memory alternatives for the M525dn model

    ● SSM SanDisk 8 GB

    ● Lock key

    Installation instruction ●

    CF116-67916

    Hard drive Kit

    Replacement HP encrypted high hard drive Performance for the M525f model

    ● HDD 250 GB SED

    ● hard disk support

    Installation instruction ●

    CF116-67907

    Hard drive Kit

    Replacement HP encrypted high hard drive Performance (Government option)

    ● HARD DRIVE 320 FIPS140

    ● hard disk support

    Installation instruction ●

    CF116-67915

    Tray 2, tape only RM1-8512-000CN

    Tray 3, cassette only RM1-6279-000CN

  • I need to create a table of contents in iPages but I want only one word for the title, not the line of holes. Or, how can I change the contents of the table? Thank you!

    I need to create a table of contents in iPages but I want only one word for the title, not the line of holes. Or, how can I change the contents of the table? Thank you!

    Yes, you can have a one word title, by assigning a paragraph style title to this one word. No, you cannot change the text in a Table of contents, but you can change paragraph style font attributes (line) and add for example, a head of points between the types of OCD paragraph and page numbers. No part of the table of contents will not provide hyperlinks in exported PDF documents.

    When you look up in the menu bar, you can see the word iPages, or simply Pages. There is no product of iPages.

  • Looking for an AC adapter and power cord for a HP Pavilion 2 p-1105, PN:QW819AA. Parts order fiasco.

    Not my computer, but my father, apparently he has lost the power adapter and power cord before he surrendered.

    I have never had a difficult experience find a part, it's like the HP support site is this circular black hole. I understand that this isn't a standard power supply, but HP power cord... Seriously, why the specifications list and the list is not part numbers.

    Call the customer support isn't much better, was routed from the line parts store to the HP Shopping, back to the parts store channel. Each single representative that I spoke too cannot identify this part.

    a guy tried to tell me everything that I needed was a rope, according to the installation instructions, is not correct.

    At this point, I'm extremely frustrated and very unlikely never recommend or buy an HP product again.

    Here are the specifications of the desktop HP Pavilion p2-1105. According to the specifications of the computer, this model requires an external power supply with the following features;

    External 90W power supply (100V-240V)

    Total wattage: 90W

    Input voltage:

    100-127V/3A (50-60 Hz)

    200-240 v/2A (50-60 Hz)

    Output voltage: 19V

    Based on the HP part Surfer parts list for the product number: QW819AA - model name: desktop HP PAVILION P2 - 1105, the following seem to be what you are looking for.

    HP P/N 213349-001 - cord (black) - three sons, 3.0 m (9.8 ft) long - right taken C5 (F) (Canada and United States)
    HP P/N 619752-001 - food - Ext AC Adpt Lolonis-r RT Angle Connector 90W

    HP P/N 695835-001 - 90W square EPS (Domino) 3 p (which seems to be an alternative to the HP P/N 619752-001)

    Please send Bravo

  • How to set the {} num.currency such way that it will display "-" sign for negative numbers instead of "()".

    Hi people from Adobe,.

    I am working on a form of invoice of Adobe, where currency a few fields may show as "-" if it is the negative number.

    I use display model num.currency {}, but its poster ($1,234,567.89), I want to display in the form $-1,234,567.89

    Is someone can you please let me know how to achieve this.

    2-25-2016 1-16-10 PM.jpg

    2-25-2016 1-27-20 PM.jpg

    Hello

    I wondered if it would be that simple.  It seems that the United States and Hong Kong are the only ones who use the media for negative numbers.  The Australian currency displayed as you wish.  Maybe you can go into the XML Source and change the line $z, zz9.99 | () $z, zz9.99) $z , zz9.99.  This is how the Australian looks... would need a few tests well.

    Or maybe you can have the hidden decimal field and display a text field with a calculation as DecimalField.formattedValue.replace(/[()]/g,"");. " Do you need to align the decimal points?

    Bruce

  • How to remove the numbers on blank lines without fully justify above the text?

    Hello everyone.

    I have a problem with my numbering.  I would like to delete the line numbers where there is no text.  But when I back off the line of text without deleting the number, then shift + return to add a paragraph break 'justifies all lines'.  He said that it's always "justify the last line aligned to the left", but is not, and I can't change it back. I tried to manually change the justification, but it is so hard to do with all the paragraphs, and it looks like not equal. I have attached a few screenshots to illustrate my problem.

    Anyone know how I can remove the numbers of the lines without text without manually clicking the line line, ranging from 'bullets and numbers' and clicking on 'none' for each line?

    Or if I can't do that, do you know how I can stop the above paragraph that justify completely once I deleted the number of rollback?


    Thank you very much in advance, I really appreciate all the help you can give.  It's great that forums like this are there to help.


    justification issue.jpg

    Above is the screenshot where you can see that there are a number (25) on the empty text line.
    This is when I removed by backspacing of the line and then shift + return to add a new line, but her line above is fully justified, and not justified with the last line aligned to the left.

    justification issue2.jpg

    Thanks for your help!  Natasha, a user of InDesign beginner.

    Return shift is a forced line break, so you now a last blank line, and is the one who remains aligned. ID does exactly what it's supposed to.

    Instead of trying to use blank lines to separate paragraphs you should use space after or front of the space.

Maybe you are looking for

  • C drive is nearly full, E reader almost empty

    Hi all I'm not computer so apologies in advance. I read other threads here about the same problem, but am still not sure if there is anything I can do about it. I have a laptop with VISTA home premium pre-installed SATELLITE. The computer is about 5

  • Two questions about HD Dock.

    1 - I want to know what is the left button on the remote for? OK, I just see an answer to this Q in another post. 2 - can I put the phone on the dock all night or it will ruin my battery? (I know that its supposed to work like an alarm clock). That's

  • RTFTrack has stopped working message followed computer crash

    I have a Lenovo Edge 15 (got 11/03/15). Recently, when using SKYPE, making a video call, a box has developed indicating that RTFTrack has stopped working. The screen becomes white, then the computer crashes. So my call is disconnected, my computer re

  • my account has been hacked several times and sends mail spam to the people on my list

    my account has been hacked several times and is to send spam to people on my list. I changed my password several times and it continues to happen. I took everyone off my email list with the exception of an e-mail address that I created to alertme in

  • What is your experience with Sandisk RMA?

    I'm back my rocket v2 due to a broken headphone jack.  I diagnosed this problem largely because of you guys.  Thanks again!   I am afraid they could give me a rocket + replacement, I don't want to, because it is known to be of lesser quality than the