How to find first, second, last and before final string DB10G

Hello

one of my string like below, separated by (|)

20111008133638 | 20111112000531 | 20111212004432 | 20120226235444 | 20120127173533

I want to find (first, second, the penultimate and last) string.

Please all help

Hello

You can use this:

with a
as
(
select '20111008133638|20111112000531|20111212004432|20120226235444|20120127173533' str
from dual)
select regexp_substr(str,'[^|]+',1,1) first,
regexp_substr(str,'[^|]+',1,2) second,
regexp_substr(str,'[^|]+',1,length(regexp_replace(str,'[^|]')) )before_last,
regexp_substr(str,'[^|]+',1,length(regexp_replace(str,'[^|]') )+ 1) last
from a

See this:

SQL> with a
  2  as
  3  (
  4  select '20111008133638|20111112000531|20111212004432|20120226235444|2012012
7173533' str
  5  from dual)
  6  select regexp_substr(str,'[^|]+',1,1) first,
  7  regexp_substr(str,'[^|]+',1,2) second,
  8  regexp_substr(str,'[^|]+',1,length(regexp_replace(str,'[^|]')) )before_last
,
  9  regexp_substr(str,'[^|]+',1,length(regexp_replace(str,'[^|]') )+ 1) last
 10  from a;

FIRST          SECOND         BEFORE_LAST    LAST
-------------- -------------- -------------- --------------
20111008133638 20111112000531 20120226235444 20120127173533

SQL>

Edited by: Manguilibe KAO March 14, 2012 00:32

Tags: Database

Similar Questions

  • How to find the value max and min for each column in a table 2d?

    How to find the value max and min for each column in a table 2d?

    For example, in the table max/min for the first three columns would be 45/23, 14/10, 80/67.

    Thank you

    Chuck,

    With color on your bars, you should have enough experience to understand this.

    You're a loop in the table already.  Now you just need a function like table Max and min. loop.  And you may need to transpose the table 2D.

  • How to find the second largest in a pl/sql table

    Hello friends,

    I want to find the first and second maximum items in a pl/sql table.

    Here's the code...

    DECLARE
    Max_earnings_type TYPE TABLE IS NUMBER;
    max_earnings_tab max_earnings_type: = max_earnings_type();
    number of v_count: = 0;
    number of v_max_earnings;


    Can someone give me how to find the maximum first max and second in the type of the given table.

    appreciate your help.

    Thank you/kumar

    Published by: kumar73 on October 21, 2010 09:42

    kumar73 wrote:

    When I tried to implement your logic in my application, I get the following error...

    PL/SQL: digital or value error: NULL index key value table

    What happens if the PL/SQL table has NULL values. Question is how you want to handle NULL values. You want to ignore nulls as GROUP BY do? If you want to consider NULL values, you can say if you want to order the NULLS FIRST or NULLS LAST. I guess that logical GROUP BY:

    DECLARE
        TYPE max_earnings_type IS TABLE OF NUMBER;
        TYPE max_earnings_sorted_type IS TABLE OF NUMBER
          INDEX BY BINARY_INTEGER;
        max_earnings_tab        max_earnings_type;
        max_earnings_tab_sorted max_earnings_sorted_type;
    BEGIN
        SELECT  sal + comm
          BULK COLLECT
          INTO  max_earnings_tab
          FROM  emp;
        FOR v_i in 1..max_earnings_tab.count LOOP
          IF max_earnings_tab(v_i) IS NOT NULL
            THEN
              max_earnings_tab_sorted(max_earnings_tab(v_i)) := 1;
          END IF;
        END LOOP;
        DBMS_OUTPUT.PUT_LINE('MAX value in PL/SQL table is ' || nvl(to_char(max_earnings_tab_sorted.last),'NULL'));
        DBMS_OUTPUT.PUT_LINE('Second MAX value in PL/SQL table is ' || nvl(to_char(max_earnings_tab_sorted.prior(max_earnings_tab_sorted.last)),'NULL'));
    END;
    /
    MAX value in PL/SQL table is 2650
    Second MAX value in PL/SQL table is 1900
    
    PL/SQL procedure successfully completed.
    
    SQL> SELECT  sal + comm
      2    FROM  emp;
    
      SAL+COMM
    ----------
    
          1900
          1750
    
          2650
    
          1500
    
      SAL+COMM
    ----------
    
    14 rows selected.
    
    SQL>
    

    SY.

  • How to find the model, product and serial number on your Hp Printer.

    This video shows you how to find your model number, product number and the serial number of your Hp Printer.  This information is required to use the Hp customer care website, downlad the latest drivers, find product specifications, order correct substitute parts, troubleshooting to find the items and validate the warranty status.

    * If you find this useful or mean please make sure you click on the White Star under my name to give me congratulations. **

    I hope this helps!

  • How to find my WEP key and the name of my network?

    I need to reset my wireless printer to scan.  It asks for my WEP key and I thought it was one that is not correct.  How to find the right WEP key and my correct network name? I have a laptop HP Pavilion dm4 with HP scanner/printe wireless

    You must log - on to your AP or wireless router and look for the 'Wireless' or similar tab for your WEP key and the network name (SSID). Or you may be able to locate the information by going to control Panel\All Control Panel Items\Network and Center sharing on your laptop.

    Frank

  • How to find the session killed and computer name

    Hello

    At the time of the batch run killed .somebody this session without me knowing how to find the user particular db level or oslevel .de name which machine they killed how know at the OS level. but when I put the audit_trail = os only user SYSDBA activities are not checked the other activities of the user.

    The server is AIX and db version 11i provide the query for conclusion or os level.

    Thank you
    DBC.

    Published by: dbc001 on March 26, 2013 21:48

    check with who ever is privilleges to kill these perticluar session, if you have few users.
    It is not possible to findout without verification or error info... etc.
    Otherwise, restart these jobs perticluar and follow closely.

  • How to get back to CC2014 and before?

    Earlier this year, CC 'upgraded' me to CC2015. In contrast to previous updates, it deleted my (work) Illustrator of earlier versions. Although he has promised to transfer all my plugins and settings, none of them have been transferred across. I have little use for news, but some of the plugins have been intensely valuable (and much more expensive than Illustrator) and shades of color user seem sunk. It comes as a consultant of the brand, my bread and butter.

    I would have never allowed the upgrade if I thought I'd lost the previous versions.

    How to make a comeback?

    To install an earlier version:

    https://helpx.Adobe.com/creative-cloud/help/download-install-app.html#topic-3

    To retrieve your user libraries: you might find in your cloud file if there is a set of preferences old you may have saved for synchronization purposes. Also search your backup (Time Machine)?

  • How to find the value max and min of an attribute for a master VO

    Hello
    Is it possible to find maximum and minimum a master view object attribute values in groovy.
    I need to have the (START_DATE) min and max (end_date), values to pass to my Gantt chart to the table project start date and end date.
    For detail view objects, we can use < accessor > .max (start_date), but to see Master objects?

    I use jdeveloper 11.1.1.3.

    Thank you
    Guna.

    Published by: guna.b on December 13, 2010 11:01

    How about setting GOES to the same point of view and by using the groovy you mentioned in your message

  • How to find no work plans and the lines of a doc. ?

    Hello

    could someone tell me how to count the number of work plans and existing lines in the document?

    the CS4 API can do?

    I couldn't find all the suites do.

    Please help I'm stuck.

    Thank you

    DeepAlone.

    The number of work plans is easy: AICropAreaSuite::GetCount() in AICropArea.h. The number of lines? It's more complicated, since there is no ownership of it. You figure, however, using the methods of AICropArea to join the rectangles (see struct above) of each work plan (or "box frame" as they are called in the nomenclature of the CS4 API). There is no guarantee that they are in lines, of course, since they can be moved. You can take a stab but looking at the top & bottom and see if a bunch of them line up; which would give you meaning to all the lines are there is they are in lines.

  • How to find the percentage, division and the other half sign on my iMac

    Please can you help. How can I do per cent, of division and half of the signs on my iMac [El Capitan]

    There are simple shortcuts per cent and division:

    SHIFT % + 5

    ÷ Option + /.

    As the ½ side, there is no shortcut to it, but you can use the Emoji keyboard and symbols.

    You will need to activate it in the keyboard preferences (System preferences - keyboard - put a check mark next to display keyboard, Emoji, and viewers of symbol in the menu bar). After you select it, you can use shortcut ⌃⌘Space to open this keyboard or Edit - Emoji & symbols.

    If you do not ½ character in this toolbar, you can search by key word "half" and add it to your favorites for quick access.

  • How to find my network name and address

    I'm trying to set up the fax send and receive on windows 7 and I have born my network name and address to enter when prompted. I spent all day searching the Internet for help and it is impossible to find. Help, please.!

    Hi Chiquitita,

    Your computer is connected to a domain network?
     
    If your computer is connected to the domain network, you need to contact the system administrator to know the network address of the fax server.

    I suggest you refer to the following article for detailed instructions to set up the fax.
    Configure your computer to send and receive faxes

    http://Windows.Microsoft.com/en-pH/Windows7/set-up-your-computer-to-send-and-receive-faxes

    To find your network name or the SSID:
    Type the IP address of the router in your browser, go to wireless settings and check the SSID there.

    I hope this helps!

  • How to find 'the server address' and 'domain' outlook configuration in mail account name?

    Now mail to install on my new laptop that runs Windows 8.  I used outlook on my old laptop to access an email account @iolfree.ie.  The mail app asks me to enter the address of the server and domain, but I don't know where to find these.  Any help would be greatly appreciated.

    You will need to find this information on the site iolfree.ie.  There should be a section in their FAQ section or help telling you this information.

  • How long does the license last and I can use it?

    I am a student of cilex studies to become a legal framework for the next two years. I want to buy the cs6 suite edition standard teachers stident. First of all, I want to know if my student cilex membership allows me to do. Second, I would like to know if there is an export for the student permit, or is it mine for life? I don't want my license to be disabled after a period of time or are no longer usable after ive finished studying? Thank you

    Hi Sarah,.

    Please visit the FAQ of | Adobe Creative Suite

    Hope that helps!

    Kind regards

    Sheena

  • How to find the user name and a name indatapump import tablespace

    I have a datapump without the export log file. I would like to import it into a database. Before you begin the import, I would like to know the schema and the tablespace which exported so that I can remap the schema and the tablespace to others. Is there anyway that I can do

    You can run your import command, but add this:

    include tablespace, sqlfile = look.sql user =

    The look.sql file will have the tablespace create orders and orders for the user to create.

    Edit look.sql to see what are the names of tablespace and user.

    Dean

  • How to find MSHTML. HLP and install it?

    Windows XP he.sp3.  Can not save the images. Need to reinstall MSHTML. HLP

    What is the error message that you receive?

    Provide more information:

    How to ask a question
    http://support.Microsoft.com/kb/555375

    Visit this link for a fix:

    Lack file mshtml.hlp
    http://forums.techguy.org/Windows-XP/503775-missing-file-Mshtml-hlp.html

Maybe you are looking for

  • Anyone can delete my Skype account and contacts? They threaten to me... to take the money

    Please dwlete my xxxxxxxxxxxxxxx account service to talk to someone? before find.u here

  • LaserJet P2015DN

    Using Windows 7 64 bit.  Printer continues to change IP addresses every two days.  Went de.3.4 and now a.5.  Whenever I've added a new printer port "to add a port", but nothing does.  Any solution to keep this printer on the network?

  • ERROR FATAL Service Pack 2 / GLITCH

    I recently installed service pack 2 and now the computer I'm running on Dell studio 1537 turns off without displaying a stop screen or advising me an error (bsod, etc.) when I go to reboot the system, it will say that he has himself turned off to pro

  • Volume missing from the taskbar icon

    My Volume icon and thus my network icon disappeared from the taskbar and "grayed out" in the properties area.  I use Windows Vista Home Premium SP2.  How can I get back them?

  • IPS 4260 sensor - NETWORK ports

    The IPS 4260 only comes with 1 port NIC, is what it means he cannot run in promisicious mode and must purchase additional NETWORK card interfaces to run inline?