Extract multiple substrings between 2 characters from 8000 characters text .

Hi Jonathan,
I have a text column which has text and email addresses to which email was sent, i want to collect the list of domains in the text.
Ex: ' email sent to abcdotcom; email sending failed; email sent to xxxdotcom; email sent to yyydotcom; email failed'
I want to extract  list if domains listed in the text, i am trying to extract multiple sub string values in between @ and . characters.
Thanks in advance!

You can use SPLIT function in order to split the string into several values (In the case of using table function you get several rows return)
Here you can find a great CLR split function that you can use:
http://sqlblog.com/blogs/adam_machanic/archive/2009/04/28/sqlclr-string-splitting-part-2-even-faster-even-more-scalable.aspx
Here you can see why you have to use CLR and not T-SQL function:
http://sqlperformance.com/2012/07/t-sql-queries/split-strings
For the
part of cleaning the string I will recommend to use regular expression which you can combine in the SPLIT function as on function (best solution) or use before.
check this link: http://msdn.microsoft.com/en-us/magazine/cc163473.aspx
** I your case you can just use Regular Expressions directly and finct what you need without split (I think.. we just need to think about the right Expressions)
[Personal Site] [Blog] [Facebook]

Similar Messages

  • Substring between two words from a clob

    How to extract a string between two words from a clob variable in PL/SQL?

    My requirement is to extract the soap envelope from a clob. In the below code l_response returned from the http request is a clob with the below format. I need to extract all the text that is between '<s:Envelope' and 's:Envelope>'. That means I need to get rid of the first 5 lines and the last line from the l_response. Can you please help me with the logic?
    --uuid:18cb22a2-11cc-43f4-bfea-c213da179d30+id=157
    Content-ID: <http://tempuri.org/0>
    Content-Transfer-Encoding: 8bit
    Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"
    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/IUpdateService/QueryUpdateLogRecordsResponse</a:Action><a:RelatesTo>urn:uuid:413f419c-f489-44ea-bd12-dff6f24a4d71</a:RelatesTo></s:Header><s:Body><QueryUpdateLogRecordsResponse xmlns="http://tempuri.org/"><QueryUpdateLogRecordsResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://www.w3.org/2001/XMLSchema"><XObject.m_element i:type="x:string" xmlns="">&lt;QueryResult Count="2" NextStart="0" PreviousStart="0" Id="{AD62FD77-AFBE-4362-BBEF-695DA5D92640}"&gt;&lt;Columns Count="33"&gt;&lt;Column AttributeName="Id" 
    … 5 pages later…
    DateModified="2014-07-06 07:34:41.9129549-07:00" /&gt;&lt;/Records&gt;&lt;/QueryResult&gt;</XObject.m_element></QueryUpdateLogRecordsResult></QueryUpdateLogRecordsResponse></s:Body></s:Envelope>
    --uuid:18cb22a2-11cc-43f4-bfea-c213da179d30+id=157—
    DECLARE
       l_request             VARCHAR2 (4000);
       l_http_req            UTL_HTTP.req;
       l_http_resp           UTL_HTTP.resp;
       v_buffer              VARCHAR2 (32767);
       n_next_start_record   NUMBER (20) := 1;
       l_response            CLOB;
    BEGIN
       -- Call webservices. Works fine
       l_request :=
             '--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=2'
          || CHR (13)
          || CHR (10)
          || 'Content-ID: <http://tempuri.org/0>'
          || CHR (13)
          || CHR (10)
          || 'Content-Transfer-Encoding: 8bit'
          || CHR (13)
          || CHR (10)
          || 'Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"'
          || CHR (13)
          || CHR (10)
          || CHR (13)
          || CHR (10)
          || '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/IUpdateService/QueryUpdateLogRecords</a:Action><a:MessageID>urn:uuid:413f419c-f489-44ea-bd12-dff6f24a4d71</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://dexdb5/DexNETWebServices_4_0_0_4/UpdateService.svc</a:To></s:Header><s:Body><QueryUpdateLogRecords xmlns="http://tempuri.org/"><context xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://www.w3.org/2001/XMLSchema"><XObject.m_element i:type="x:string" xmlns="">&lt;OnlineContext SystemId="'
          || g_system_id
          || '" SessionId="'
          || g_session_id
          || '" UserId="'
          || g_user_id
          || '" /&gt;</XObject.m_element></context><xQueryRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://www.w3.org/2001/XMLSchema"><XObject.m_element i:type="x:string" xmlns="">&lt;QueryRequest Start="'
          || p_next_start_record
          || '" Count="'
          || g_records_count
          || '" Distinct="0" OrderBy="" Condition="(oUpdateLog.DateCreated &amp;gt;= '''
          || p_last_load_time
          || ''')" ColumnInfo="1" /&gt;</XObject.m_element></xQueryRequest></QueryUpdateLogRecords></s:Body></s:Envelope>'
          || CHR (13)
          || CHR (10)
          || '--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=2--';
       l_http_req :=
          UTL_HTTP.begin_request (g_query_updatelog_records_url, 'POST', 'HTTP/1.1');
       UTL_HTTP.set_header (l_http_req, 'MIME-Version', '1.0');
       UTL_HTTP.set_header (
          l_http_req,
          'Content-Type',
          'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=2";start-info="application/soap+xml"');
       UTL_HTTP.set_header (
          l_http_req,
          'VsDebuggerCausalityData',
          'uIDPo5F/qXRc4YJImqB6Ard30cQAAAAAAjIXinpIVUulXLJOsSG7yyv7Lf2yHgpHlIxvc6oeqaAACQAA');
       UTL_HTTP.set_header (l_http_req, 'Content-Length', LENGTH (l_request));
       UTL_HTTP.write_text (l_http_req, l_request);
       DBMS_LOB.createtemporary (l_response, FALSE);
       l_http_resp := UTL_HTTP.get_response (l_http_req);
       BEGIN
          LOOP
             UTL_HTTP.read_text (l_http_resp, v_buffer, 32767);
             DBMS_OUTPUT.put_line (v_buffer);
             DBMS_LOB.writeappend (l_response, LENGTH (v_buffer), v_buffer);
          END LOOP;
       EXCEPTION
          WHEN UTL_HTTP.end_of_body
          THEN
             NULL;
       END;
       UTL_HTTP.end_response (l_http_resp);
       l_response := DBMS_XMLGEN.CONVERT (xmldata => l_response, flag => 1);
       -- Extract the soap envelope from clob. Issue because of the 32767 characters limitation
       SELECT    DBMS_LOB.SUBSTR (                  -- Problem here
                    l_response,
                      INSTR (l_response, 's:Envelope>', -1)
                    - INSTR (l_response, '<s:Envelope'),
                    INSTR (l_response, '<s:Envelope'))
              || 's:Envelope>'
         INTO l_response
         FROM DUAL;
          -- Parse the xml. Works fine once the above issue is fixed
          SELECT xt.nextstart
            INTO n_next_start_record
            FROM XMLTABLE (
                    xmlnamespaces ('http://www.w3.org/2003/05/soap-envelope' AS "s",
                                   'http://tempuri.org/' AS "data"),
                    's:Envelope/s:Body/data:QueryUpdateLogRecordsResponse/data:QueryUpdateLogRecordsResult/XObject.m_element/QueryResult'
                    PASSING xmltype (l_response)
                    COLUMNS nextstart NUMBER (20) PATH '@NextStart') xt;
       DBMS_OUTPUT.put_line ('NextStart ' || n_next_start_record);
    END;

  • How do I extract multiple tracks from a CD into a single file in Audition CS6?

    I use Audition to edit my Pastor's messages. The message CD is made with five minute tracks. I want to extract the tracks from the CD into a single file for editing and altering the track lengths. I have done this before in Audition CS6, but I haven't been able to find instructions for it. I only found a note stating this is available in AuditionCC.

    I have discovered an answer to my problem. The way to bring multiple tracks into Audition CS6 from a CD is to use the FILE / OPEN APPEND / TO NEW command. This brings the separate tracks into a single file in Audition CD6. Thanks to everyone who commented.

  • Load multiple records in 1 table from 1 line in text file w/sql loader

    hi guys,
    quick question, perhaps someone can help. searched around and didn't see this question asked before, and can't find any answer in SQL Loader faqs or docs.
    i know i can extract multiple logical records from a single physical record in the input file as two logical records, and then use two into tables clauses to load the data into the table. see oracle 9i sql loader control file reference chapter 5 to see what i am talking about.
    but my question follows:
    cust_id amount1_val amount1_qual amount2_val amount2_qual amount3_val amount3_qual
    123 1500.35 TA 230.34 VZ 3045.50 TW
    basically i want to use one sql loader statement to load these 3 records into 1 table. the issue for me is that i need to re-use the cust_id for all 3 records as the key, along with the qualifier code. the example in the Oracle docs only works for data where the logical records are completely separate -- no shared column values.
    i'm sure this is possible, perhaps using some :cust_id type parameter for the 2nd and 3rd records, or something, but i just don't have enough knowledge/experience with sql loader to know what to do. appreciate any help.
    wayne

    Hi wayne,
    I found an example on what exactly you were looking for from an SQL*Loader documentation. Please see if it of some help to you
    EXAMPLE
    The control file is ULCASE5.CTL.
    1234 BAKER 10 9999 101
    1234 JOKER 10 9999 777
    2664 YOUNG 20 2893 425
    5321 OTOOLE 10 9999 321
    2134 FARMER 20 4555 236
    2414 LITTLE 20 5634 236
    6542 LEE 10 4532 102
    2849 EDDS xx 4555
    4532 PERKINS 10 9999 40
    1244 HUNT 11 3452 665
    123 DOOLITTLE 12 9940
    1453 MACDONALD 25 5532
    In the above datafile
    Column1 - Empno
    Column2 - ENAME
    Column3 - Depno.
    Column4 - MGR
    Column5 - Proj no.
    -- Loads EMP records from first 23 characters
    -- Creates and loads PROJ records for each PROJNO listed
    -- for each employee
    LOAD DATA
    INFILE 'ulcase5.dat'
    BADFILE 'ulcase5.bad'
    DISCARDFILE 'ulcase5.dsc'
    1) REPLACE
    2) INTO TABLE emp
    (empno POSITION(1:4) INTEGER EXTERNAL,
    ename POSITION(6:15) CHAR,
    deptno POSITION(17:18) CHAR,
    mgr POSITION(20:23) INTEGER EXTERNAL)
    2) INTO TABLE proj
    (empno POSITION(1:4) INTEGER EXTERNAL,
    3) projno POSITION(25:27) INTEGER EXTERNAL) -- 1st proj
    Notes:
    REPLACE specifies that if there is data in the tables to be loaded (EMP and PROJ), SQL*loader should delete the data before loading new rows.
    Multiple INTO clauses load two tables, EMP and PROJ. The same set of records is processed three times, using different combinations of columns each time to load table PROJ.
    Regards,
    Murali Mohan

  • How can I get extract the data between two cursors on an XY graph

    How can I get extract the data between two cursors on an XY graph

    Well, you say xy graph, so this might be a more complicated problem.
    For a waveform graph it's trivial. Simply get the two cursor indices (property: cursor index) and apply them to array subset of the data. Is that all you need?
    Here's how the above code would look like. using cursor.index instead of cursor.x elimnates the need to include scaling information.
    For an xy graph, there could be multiple segments (e.g. imagine a spiral that passes the desired x range multiple times from both sides). This would neeed significantly more code for a general solution.
    Message Edited by altenbach on 11-24-2009 07:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    cursorsubset.png ‏17 KB

  • Need to extract userid and Line 1 information from CUCM

    I'm trying to automate the extraction of userid, phone number, and device name using AXL.  The query I have returns all lines associated with a device and I need only the information associated with the phones' Line 1 (since that's the user's personal number in all cases).  The query I'm using is this:
    select enduser.userid, numplan.dnorpattern, e164Mask, device.name from enduser inner join enduserdevicemap on enduser.pkid=enduserdevicemap.fkenduser inner join device on enduserdevicemap.fkdevice=device.pkid inner join devicenumplanmap on device.pkid=devicenumplanmap.fkdevice inner join numplan on devicenumplanmap.fknumplan=numplan.pkid
    I either need the query to return only Line 1, or to return the line number information so my script can just pull out the Line 1 data.  I've tried using the "FIRST 1" syntax mentioned in the AXL cookbook but that just limits the output to the device's first entry in the table, not the actual Line 1 button.

    Hi
    You just need to specify numplanindex =1 in the devicenumplanmap table.
    run sql select enduser.userid, numplan.dnorpattern, e164Mask, device.name from enduser inner join enduserdevicemap on enduser.pkid=enduserdevicemap.fkenduser inner join device on enduserdevicemap.fkdevice=device.pkid inner join devicenumplanmap on device.pkid=devicenumplanmap.fkdevice inner join numplan on devicenumplanmap.fknumplan=numplan.pkid where devicenumplanmap.numplanindex = 1 and enduser.userid = 'gbcaxh06' group by userid,name,dnorpattern,e164mask
    I've also added a group-by clause, as multiple links between user and dev (e.g. for CTI Controlled and EM device profiles) causes some duplication of results.
    Regards
    Aaron

  • What is difference between 2 characters Glyphs?

    Sample data : Dropbox - test.indd
    If I copy content of TextFrame to Excel or Notepad, only first character can display.
    Why? What is difference between 2 characters Glyphs?
    How can set Character 2 can display the same character 1  if copy to Excel or Notepad?

    For some reason, your second character is set as invalid (Unicode: 0x1A). Looks like you used XML...
    I think , it can.
    I use Indesign SDK:
    I want get content of glyphs ,display  in Excel and can get it from Excel set again to Indesign.

  • Passing multiple parameters between two report portlets on the same page

    Hi,
    I want to pass multiple parameters between two report portlets on the same page.
    I have been succussful passing a single parameter between two portlets. The
    following are the steps :
    (1) Created first report based on the query
    SELECT htf.anchor('http://192.168.0.84:7778/servlet/page?&_pageid=97&_dad=portal30&_schema=portal30&_mode=3&dept_code='||DEPTNO,DEPTNO) Department, ename FROM EMP;
    (2) Created 2nd report
    select * from EMP where DEPTNO = :dept_code
    (3) Added pl/sql code before display page on the 2nd report
    portal30.wwv_name_value.replace_value(
    l_arg_names, l_arg_values,
    p_reference_path||'.dept_code',portal30.wwv_standard_util.string_to_table2(nvl(g
    et_value('dept_code'),10)));
    (4) Created a page and added these reports as portlets.
    Sofar it works fine for one parameter (deptno) . Now I want to add one more
    parameter say empno to my first report query and would like to pass both the
    parameters deptno and empno to the 2nd report. Please tell me how to pass multiple parameters ?
    Thanks
    Asim

    Hi,
    You will have to do the same thing
    The select will be like this
    SELECT htf.anchor('http://toolsweb.us.oracle.com:2000/servlet/page?_pageid=97&_dad=mb&_schema=mybugs&_mode=3&dept_code='||DEPTNO||'&empno='||empno,DEPTNO) Department,ename
    FROM EMP
    In the additional plsql code do the same for empno like this
    mybugs.wwv_name_value.replace_value(l_arg_names,l_arg_values, p_reference_path||'.dept_code',mybugs.wwv_standard_util.string_to_table2(nvl(get_value('dept_code'),10)));
    mybugs.wwv_name_value.replace_value(l_arg_names,l_arg_values, p_reference_path||'.empno',mybugs.wwv_standard_util.string_to_table2(get_value('empno')));
    Thanks,
    Sharmila

  • Drag and drop of multiple nodes between 2 trees

    Hi,
    I am trying to implement a drag and drop of multiple nodes between two different trees. A simple drag drop written on the lines of the demo code RSDEMO_DRAG_DROP_TREE_MULTI works perfectly fine. But my requirement is, when a child (leaf) node is dragged, if its parent is not present in the target tree, that too has to be dragged and dropped from left to right. When I try to manually add nodes to the target tree, it dumps because the node key table and drag drop object have fewer nodes than what I am trying to add. So it always dumps in the drag_drop_complete method.
    I have also tried putting this code in the PBO of my screen, calling a subroutine to refresh my tree with all nodes required. But I realise that the PBO does not get called after a drag drop. Is there a way to achieve this? Any help would be greatly appreciated. Thank you.
    Regards,
    Nithya

    There's a Multi-Select TreeView sample on the WindowsClient.com, you can download it. Then you can drag multi nodes as follows:
    Code Snippet
    private void Form2_Load(object sender, EventArgs e)
                this.listBox1.AllowDrop = true;
                this.listBox1.DragOver += new DragEventHandler(listBox1_DragOver);
                this.listBox1.DragDrop += new DragEventHandler(listBox1_DragDrop);
                this.multiSelectTreeView1.ItemDrag += new
                     ItemDragEventHandler(multiSelectTreeView1_ItemDrag);
            void multiSelectTreeView1_ItemDrag(object sender, ItemDragEventArgs e)
                this.multiSelectTreeView1.DoDragDrop(this.multiSelectTreeView1.SelectedNodes,
                     DragDropEffects.Move);
            void listBox1_DragDrop(object sender, DragEventArgs e)
                ArrayList selectNodes = e.Data.GetData(
                    e.Data.GetFormats()[0]) as ArrayList;
                foreach (TreeNode node in selectNodes)
                    this.listBox1.Items.Add(node.Text);
            void listBox1_DragOver(object sender, DragEventArgs e)
                 e.Effect = DragDropEffects.Move;

  • Multiple Spaces between words in Java

    Hi All
    String s1 = "boy";
    String s2 = "girl";
    String s = s1 + "multiple spaces through keyboard spacebar writing this because when this is posted it will not be visible in the browser" + s2;
    system.out.println(s);
    I need to have multiple spaces between s1 and s2 and need to be shown in the browser(IE) in java.
    If it is a html code, I found we can use <pre> tag,  
    Thanks

    JoachimSauer wrote:
    JoachimSauer wrote:
    commonly written as " "Sorry, the forum software ate what I wrote here. Actually it is written as "& nbsp;" (but without the space, that I needed to add to keep the forum software from butchering it again).You can display a "raw" entity by escaping the ampersand: &#38;#38;nbsp; I use &#38;#38; instead of &#38;amp; because &#38;amp; doesn't work inside CODE blocks, and &#38;#38; does.
    Of course, all this only applies until the next site upgrade, when they break half the existing features in the process of adding a bunch of new features that nobody wanted. :P

  • Extracting Multiple Table Data Dynamically..Table is an Input parameter

    Hi All
    Can any one update the Program/design of extracting multiple table data as a list or to an excel sheet
    For eg:- Mutliple Tables are entered in selection screen and upon executing the output should be to an excel sheet sequenctially according to the table names entered in the selection screen
    Awaiting for your update
    Regards
    Shiva
    Edited by: shivakumar bandari on May 29, 2009 9:35 PM

    HI Naimes
    Thanks for youe reply
    your second step says to select data from 'table' here tables are dynamic in nature I mean they are an input parameters..how can I write select on a table..
    I can get the table existence from DD02L table and pass the retrieved tables to FM Get_Component_List to get the fields existing for the particular table,
    But I cannot pass the dynamic table value to select query to retrieve the data..Please update me if you have anything on retrieving data from dynamically inputted value
    Can I do this
    Select * from <dyntable>
    Any suggestions will be appreciated
    thank you

  • What is the defference between select single * from and select * from Where

    What is the defference between select single * from and select * from Where
    which is prefferable and best one.

    Hai,
    *Difference Between Select Single and Select * from table UpTo One Rows:*
    According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields.
    select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index.
    The best way to find out is through sql trace or runtime analysis.
    Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.
    The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
    The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.
    Mainly:  to read data from
    The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.

  • Extract a value of a fields from an internal table

    hello everyone,
    i need to extract a value of a fields from an internal table, the fields is in a postion "sy-tabix" that i know, so i need to pick this value without using a loop
    thank you.

    Like this?
    DATA: FIELD1 TYPE C,
               FIELD2 TYPE C.
    READ TABLE T_TAB INDEX 3.
    FIELD1 = T_TAB-FIELD1.
    FIELD2 = T_TAB-FIELD2.
    Greetings,
    Blag.

  • How do i delete  multiple emails at one time from iphone Mail account with iphone 4s?

    how do i delete  multiple emails at one time from iphone Mail account with iphone 4s?

    Better than that!
    http://www.youtube.com/watch?v=fKa-KFjUIGE
    Select a message, hold the move button, deselect the message while still holding the move button.
    A new window appears allowing you to move all messages to the trash.
    Bingo!

  • How do I process multiple files and turn them from raw to jpeg

    How do I process multiple files and turn them from raw to jpeg. Ive tried and it seems to go through the files but doesnt seem to process them or store them in the selected folder

    Yes that was the first thing I did. Then I used the process multiple files and selected a new folder to put them in and selected use open files and selected to turn them into jpeg. The images flash on the screen like they are being processed, but the folder never appears in library. Is it possible because there are a couple 16 bit files open that this corrupts the task. Do I need to create the folder first. Will elements not create the folder on its own.
    Thanks Vince

Maybe you are looking for