How to fetch data using Substring & Instring

Hi ,
I have data like
a_76488b_2780c
a_76488b_2780c_
a_76488b_c2780
a_76488b_c2780
a_31487b_5542
a_76488b_2780
i want to fetch data like last 4 numeric digit only
2780
2780
2780
2780
5542
2780

I don't know what you have against rexexp_replace, but this works if you want all the digits after the second underscore:
WITH t AS
        (SELECT 'a_76488b_2780c' str FROM DUAL
         UNION ALL
         SELECT 'a_76488b_2780c_' FROM DUAL
         UNION ALL
         SELECT 'a_76488b_c2780' FROM DUAL
         UNION ALL
         SELECT 'a_76488b_c2780' FROM DUAL
         UNION ALL
         SELECT 'a_31487b_5542' FROM DUAL
         UNION ALL
         SELECT 'a_76488b_2780' FROM DUAL
SELECT replace(after_second_und
              ,replace(translate(after_second_und
                                ,'0123456789'
                      ,NULL
              ,NULL
              ) your_number
FROM   (SELECT   SUBSTR(str,instr(str,'_',1,2)+1) after_second_und
        FROM t
YOUR_NUMBER
2780
2780
2780
2780
5542
2780

Similar Messages

  • Fetch data using structure with full working example

    does any body tell me how to fetch data using structure with full working example
    the structure name is RSTXT and the field is TXLINE
    the data in the form of text is entered from the functional side using t-code ME52N
    from there i have to fetch the data
    in smartform or in report

    using this code to get text from ME52N  this is a structure still not getting output  
    DATA:BEGIN OF TA_ROW occurs 0,
          TXZ01(1000) TYPE C,
          END OF TA_ROW.
      DATA:BEGIN OF IT_ROW OCCURS 0,
          TXZ01(1000) TYPE C,
          END OF IT_ROW.
       DATA: thread LIKE thead.
       DATA: headerid TYPE char24.
       DATA: it_text LIKE tline OCCURS 0 WITH HEADER LINE.
       data:wa_banfn like eban-banfn.
       thread-tdid = 'B01'.
       thread-tdname = headerid.
       thread-tdobject = 'EBAN'.
         select txz01 from eban into corresponding fields of table ta_row
          where banfn = wa_banfn.
       headerid = '  '.
       CALL FUNCTION 'READ_TEXT'
         EXPORTING
      CLIENT                        = SY-MANDT
           id                            = thread-tdid
           language                      = sy-langu
           name                          = thread-tdname
           object                        = thread-tdobject
      ARCHIVE_HANDLE
                                    = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
         TABLES
    lines                         = it_text
        EXCEPTIONS
          id                            = 1
          language                      = 2
          name                          = 3
          not_found                     = 4
          object                        = 5
          reference_check               = 6
          wrong_access_to_archive       = 7
          OTHERS                        = 8.
         LOOP AT it_text.
         CLEAR ta_row.
       BREAK-POINT.
      FROM THIS POINT TEXT IS COMING
         ta_row-txz01 = it_text-tdline.
         APPEND ta_row TO it_row.
         ENDLOOP.

  • How to fetch data from Mysql with SSL.

    I am using jdk1.5 and mysql 5.0.
    How to fetch data from Mysql with SSL
    I am using url = jdbc:mysql://localhost/database?useSSL=true&requireSSL=true.
    It shows error. how to fetch

    I have created certificate in mysql and checked in mysql.
    mysql>\s
    SSL: Cipher in use is DHE-RSA-AES256-SHA
    but through ssl how to fetch data in java.

  • How to fetch data where reference with two values

    Hello Gurus,
    How to fetch data from database table with two values for reference. like
             SELECT  < FIELDS>
                              FROM <DB>
                              INTO TABLE TAB2
                              FOR ALL ENTRIES IN
                              TAB1
                              WHERE
                               FIELD1 = TAB1-FIELD1 AND
                               FIELD1 =  TAB1-FIELD2.

    Hi,
    If you want to get data for both fields then Instead of AND use OR
            SELECT  < FIELDS> 
                              FROM <DB>
                              INTO TABLE TAB2
                              FOR ALL ENTRIES IN
                              TAB1
                              WHERE
                               FIELD1 = TAB1-FIELD1 OR
                               FIELD1 =  TAB1-FIELD2.
    Or if you want that only common data for both fields should be fetched then create new internal table. Append data of both fields into that table. Sort new table and do delete adjust duplicate. Now use new internal table in your select query.
    Let me know if this helps.
    Regards,
    Jigar Thakkar.

  • How to fetch data from PTREQ tables

    I need to display  data in the customised webdynpro application from PTREQ tables.
    Can anyone help me out how to fetch data from these tables.

    use the standard modules like
    PT_ARQ_REQUEST_CHECK
    PT_ARQ_REQUEST_EXECUTE
    PT_ARQ_REQUEST_PREPARE

  • How to fetch data from cluster tables

    hi
    i need to know  how to fetch data from cluster tables please update me if any
    i know that we cannot use joins in cluster table we use view etc
    but i need detailed inforation on methods for fetching data from cluster tables
    regards
    Nishant

    Hi,
        Check the following links
    http://fuller.mit.edu/hr/cluster_tables.html
    The specified item was not found.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33

  • A relative synced my iphone with his laptop without me knowing. It had a passcode on the phone but the sync still worked. I have since found out he is quite IT knowledgeable and has been known to track other peoples phones.  How is this data useful to him

    A relative synced my iphone with his laptop without me knowing. It had a passcode on the phone but the sync still worked. I have since found out he is quite IT knowledgeable and has been known to track other peoples phones that he wants to know information about.  How is my data useful to him and can he restore this data on another iPhone and run it parallel to mine? I have had people send me messages which I have not received. These have been screen shot to me later including time and I have just not got them. I had 4 weeks worth of messages go missing from my phone..I know that he synced my phone because his work laptops I'd came up in my settings. Also if the above can be done can he change the settings on my actual phone and access my location without placing tracking software on my phone.  Can someone please help here as I can't restore a backup to my phone for obvious reasons and refuse to change my number because of this loser.

    Connect the device to the computer.
    In iTunes, select the content desired to sync.
    Sync.
    This is all described in the User's Guide, reading it may be a good place to start.

  • How to fetch data in report related to fb03 , bkpf, bset table ?

    how to fetch data in report related to  fbo3, table bkpf, bset etc.
    if any body is having any report related to these tables then please share.

    Moderator message - Welcome to SCN.
    But please ask a specific questio - thread locked.
    Also, Please read Please read "The Forum Rules of Engagement" before posting!  HOT NEWS!! and How to post code in SCN, and some things NOT to do... and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.
    Rob

  • What is a cube? how we store data in that? how we fetch data from cube?

    Hi,
    What is a cube? how we store data in that? how we fetch data from cube?
    Regards.
    venkat

    >
    venkey B wrote:
    > Hi,
    >
    >
    > What is a cube? how we store data in that? how we fetch data from cube?
    >
    >
    > Regards.
    >
    > venkat
    Hi Venkat,
    I guess you mean an infocube from the SAP BI product. I propose to look at the forum for Business Intelligence to find your answers.
    E.g. SAP POS DM writes the sales data in infocubes.....

  • How to fetch data for sales order costing

    Hi All,
    How to fetch data for VA03 --> Extras --> Costing having cost element details.
    Thanks
    Gaurav

    Hi Gaurao ,
    There is no such function module  to extract data  in one column   , you have to  Convert all the columns data    in one column
    for period   .
    regards
    Deepak.

  • How to fetch data from DataBase using Servlet ?

    Hi all,
    Till now, i was just sending values from web page and receive the data in excel format using servlets.
    But, now, i want to fetch data from data base. I will be giving inputs in the web page(for the query)....ON click of submit button,
    Servlet should be called.
    Depending on the input, query has to be executed, and response should be sent to the user.
    How to do it?
    Code
    import java.text.*;
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.OutputStream;
    /** Simple servlet that reads three parameters from the html
    form
    public class Fetchdata extends HttpServlet
              String query=new String();
              String uid="ashvini";
              String pwd="******";
              try
                   Connection con=null;
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");     
                   String url = "jdbc:odbc:Testing";     
                   con = DriverManager.getConnection(url, uid, pwd);
                   Statement s = con.createStatement();
                   query = "select * from gowri.msllst1";
                   ResultSet rs = s.executeQuery(query);
              public void doGet(HttpServletRequest request,HttpServletResponse response)
              throws ServletException, IOException
                        response.setContentType("application/vnd.ms-excel");
                        ServletOutputStream out=response.getOutputStream();
                        out.println("<HTML>" +"<BODY BGCOLOR=\"#FDF5E6\">\n" +
                        "<H1 ALIGN=CENTER>" + title + "</H1>\n" +
                        "<table>" +" <th>ITEM Code</th>");
                        while(rs.next())
                        out.println("<tr><td>" rs.getString(1).trim()"</tr></td>");
                        }//end of while
                        out.println("</table></BODY></HTML>");
                   }//end of doGet method
         }catch(Exception e)
                        System.out.println(e);
    It is giving error message as:
    C:\Program Files\Apache Tomcat 4.0\webapps\general\srvlt>javac Fetchdata.java
    Fetchdata.java:17: illegal start of type
    try
    ^
    Fetchdata.java:48: <identifier> expected
    ^
    2 errors
    Is this format is correct? am i placing this doGet method at the right place? is my program's logic is correct?
    Please help me?
    Regards
    AShvini

    There is some mistakes in ur code.....how can try catch exists outside a function???
    make use of try catch isde ur doGet method and put
    Connection con=null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:Testing";
    con = DriverManager.getConnection(url, uid, pwd);
    Statement s = con.createStatement();
    query = "select * from gowri.msllst1";
    ResultSet rs = s.executeQuery(query);
    isdie doGet method, for the time being,
    i think u get me..
    regards
    shanu

  • How to fetch data from single database table using 2 internal tables.

    Hi friends,
    i am a new user of ABAP and also SDN.
    i need a help. 
    i want to fetch data from one database table based on primary keys of 2 internal tables.  how to put in where clause.
    Thanks in advance.

    hii
    refer to following code ..i hope it will help you
    SELECT matnr                         " Material Number
        FROM mara
        INTO TABLE i_mara
       WHERE matnr IN s_matnr.
      IF i_mara[] IS NOT INITIAL.
        SELECT matnr                       " Material Number
               werks                       " Plants
               prctr                       " Profit Center
          FROM marc
          INTO TABLE i_marc
           FOR ALL ENTRIES IN i_mara
         WHERE matnr = i_mara-matnr
           AND werks IN s_werks.
      ENDIF.                               " IF i_mara[] IS NOT INITIAL
      i_output = i_marc.
      IF i_marc[] IS NOT INITIAL.
        SELECT matnr                       " Material Number
               werks                       " Plants
               lgort                       " Storage Location
          FROM mard
          INTO TABLE i_mard
           FOR ALL ENTRIES IN i_marc
         WHERE matnr EQ i_marc-matnr
           AND werks EQ i_marc-werks
           AND lgort IN s_lgort.
      ENDIF.                               " IF i_mara[] IS NOT INITIAL
    regards
    twinkal

  • How to Fetch Data From Standard Table MARA and Display using BOPF ?

    Hello All,
    In BOPF creation of Quey to a node fetches data from the Data Base Table attached to that Node,
    But in my requirement I have to fetch data Present in a Standard table and Display it in the FPM List Using FBI.
    **  Can we Fetch the data From Standard Table and fill the Node in BOPF, Is this possible as the standard Table do not contain KEY field which BOPF uses for Data Fetching ?
    Kindly share your Idea's .
    Thanks in Adv.

    Hi Dhivya,
    Thanks For your Response.
    In my Requirement I want to make ROOT Node as Transient Node.
    When I create a Sub Node to a Root Node, I am able to get this option to make this sub node as a Transient Node .
    By selecting   'Standard<-->Extended' option in the Menu item 'GoTo' I am able to get this Transient Node check box field for the Sub Nodes.
    I want to make a ROOT Node as a Transient Node.
    (Which Version you are using, and which transaction you are using to create BO . we are using BOBX Transaction, Version Ehp 6 )
    Kindly Guide me .
    Thanks,
    Kranthi Kumar.

  • Hey guys how to fetch data from db table using subroutine

    hi guys,
                   I am fetching data from db table "mcha". now in the follwing code i get it in "HSDAT1_DATE."
                   now when i read out_tab with key "HSDAT1". it wont come in out_tab-value.plz tell me what is wrong whether some key condition in out_tab or any thing else.
    and what should i write in changing && in script.
    thanks in advance
    FORM DATE_MGF TABLES IN_TAB STRUCTURE ITCSY
                         OUT_TAB STRUCTURE ITCSY.
    tables :MCHA ,QALS.
      DATA : WERKS1 LIKE QALS-WERK.
      DATA : HSDAT1 LIKE MCHA-HSDAT.
      DATA : DATE(2),
             MONTH(2),
             YEAR(4).
    DATA : HSDAT1_DATE(10).
      READ TABLE IN_TAB WITH KEY 'QALS-WERK'.
      LOOP AT IN_TAB.
        IF SY-TABIX EQ 1.
          WERKS1 = IN_TAB-VALUE.
          IF WERKS1 NE SPACE.
            EXIT.
          ENDIF.
        ENDIF.
      ENDLOOP.
      SELECT SINGLE HSDAT INTO HSDAT1
                          FROM MCHA
                                    WHERE  WERKS = WERKS1.
      DATE = HSDAT1+6(2).
      MONTH = HSDAT1+4(2).
      YEAR = HSDAT1+0(4).
      CONCATENATE DATE '.' MONTH '.' YEAR INTO HSDAT1_DATE.
      READ TABLE OUT_TAB WITH KEY 'HSDAT1' .
      IF SY-SUBRC = 0.
        OUT_TAB-VALUE = HSDAT1.
        MODIFY OUT_TAB INDEX SY-TABIX.
      ENDIF.

    Hi,
    Let me understanf clearly what you want.
    initally mine out_tab is blank
    According to you, your table out_tab is blank. And you need to add out_tab-value = HSDAT1_date.
    READ TABLE OUT_TAB WITH KEY 'HSDAT1' .
      IF SY-SUBRC = 0.
        OUT_TAB-VALUE = HSDAT1.
        MODIFY OUT_TAB INDEX SY-TABIX.
      ENDIF.
    So, if your table is blank, then read statement will fail.
    Please let me know if your table out_tab in blank when you are reading the table and if this table contains any field called HSDAT.
    Basically i would like to know your internal table out_tab declaration.
    Thanks,
    Archana

  • How to fetch data from a SAP BW Cube via Perl/PHP on a Linux machine?

    Hi all,
    here's the scenario:
    I need to fetch data from a cube of a remote SAP NetWeaver 7.  The data will later be used in a web application based on  Linux and  Perl/PHP. (I'd prefer using perl for the backend and doing the business logic of the web application.)
    I have:
    A Linux system with all its on-board tools and scripting languages.
    A user for the SAP BW which allows me to logon (very,very limited user rights, no se37,no se80,no rsaX and so on)
    Access to http://<SAP BW Server>:<Port>/sap/bw/xml/soap/xmla with the above mentioned user.
    My questions:
    - Could you please push me into the right direction how I can realize this? E.g. by pointing to tutorials / HowTos / sample code / CPAN modules etc..  (Most information I found so far referred to software based on a different operating system and on remote function calls using custom functions.)
    - I'm aware of the  SAPNW::RFC CPAN module, but do I necessarily have to perform a remote function call? ( If so, is there a "standard" function I could call for accessing a cube?)
    Thanks a lot in advance!

    You can take through the RFCS .check for some system function modules...but why do you need to route it through XI?How huge z the files?

Maybe you are looking for

  • JDBC on Oracle 8.1.5 on Digital Unix System

    In my Digital Unix system , Oracle is loaded on a file system different from the user file system . The necessary zip files are in a directory within the Oracle home directory . When I do an import oracle.jdbc.driver.*; from a program in my user file

  • How do I create a new shopping cart in the SRM system (not portal)

    Hi, I'm working on a test landscape with Purchase request WF. I want to create a new shopping cart from the SAP system, not from the portal, and this purchase request should go to a manager approval. I've been told that I need a SRM system. Could you

  • Have changed password.  Still can't download as it will not let me get past the Name/password screen.

    I have gone through all of the hoops to download the latest Adobe Flash, but can't do it. I have gotten the emails.  Changed my password, but still can't download. My name comes up when I go to open to install, but maybe that is incorrect. However, I

  • Drag and drop not correct size

    In PSE 12 when I drag and drop a 4.8 in square image onto a 8.5x11 blank page (Both at 300 ppi) the 4.8 image does not show as small, it fills in the larger page.  What am I doing wrong? HELP!

  • Ipod Touch cant find airport express

    ive got my airport express plugged into my college dorm's ethernet port and it set up for bridge mode, as a closed network with wpa2 security. my ipod touch can never find the network to connect to and my laptop can find it and connect to it, but alw