Split string values

Hello

I have a column in a table that contains a string separated by.

for example

IT. MATERIAL
IT. APPS
HE SOFTWARE

I want to split the two out on two columns for example values

Column1 - IT
Column2 - Hardware
etc.

Can anyone help?

Thank you

Hello

Here's one way:

SELECT       SUBSTR ( str
             , 1
           , INSTR (str, '.') - 1
           )         AS column1
,       SUBSTR ( str
             , INSTR (str, '.') + 1
           )         AS column2
FROM      table_x
;

You might also achieve the same results using REGEXP_SUBTR, without nested funcitons, but it would be less effective.

I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data. Examples of special cases, you have to manage, usch as strings with 2 or more '.'s, or without any strings "." s at all.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002}

Tags: Database

Similar Questions

  • splitting the query string values

    all,
    I do not remember this, but my problem is that I have a collection of forwarded to my query as string values "X 234234: 23466 X: X 03287: X 457675 ', so my request should be able to divide each data value and use in the filter as below,

    Select * from emp where EmpID in ("X 234234: 23466 X: X 03287: X 457675")

    so, how can I divide each individual value and pass through the filter?

    Thank you.

    SELECT trim(x.column_value.extract('e/text () ')) CLO
    Of
    TABLE (XMLSEQUENCE (XMLTYPE (""
    || REPLACE ('1:2:3:4:6:7:8',': ','
    ')
    || ((("
    ").extract('e/e'))) x

    Try customizing the syntax above using the column in the function replace instead of my hard-coded string and pass it to the filter predicate using an in operator.

    Edited by: Chandrakaanth Ramamurthy on April 25, 2013 16:29

  • How to split strings?

    Hello

    I'm using action made by Christophe (http://www.vcoteam.info/learn-vco/code-snippets-cancel-one-of-your-running-workflows.html) in order to cancel some workflows.

    Since the selection for tokens window does not display the parameters of the token, I created another entry for my workflow that is supposed to contain the name of the virtual machine, only for infomational purposes.

    I created an action to do this. When I use just "return myWorkflowToken.getInputParameters ();" then all settings are written to the input box.

    In my case, it looks like this:

    {ram = 3000.0, date = Mon Jan 24 16:25:16 THIS 2011, vm = < @id = FinderResult' VC:VirtualMachine/si0vm271/vm - 852' @name = "si0vm562" >, UC = 3.0}

    Since I need only the name of the virtual machine, in this case the part after @name (si0vm562), I need to retrieve it somehow off the chain.

    In the Orchestrator API, I found the String class with the method 'split '.

    At first, I tried to split the string into two parts using this code:

    var params_s = myWorkflowToken.getInputParameters ();
    var params_a_s = params_s.split ("name");
    return params_a_s [1];

    But when I run the workflow, the input dialogue tells me that the "split" function cannot be found.

    How can I retrieve the VM name on the report of a running workflow?

    Thank you

    Concerning

    Andreas

    Hi Andreas,

    I don't think that splitting strings works for your case.

    In fact workflowToken.getInputParameters () does not return a string. It is ch.dunes.scripting.jsmodel.JSProperties instead (you can check this of the Orchestrator client tools-> API Explorer). The split function is not found on the params_s variable.

    In order to achieve your goal, you can try the following:

    get the vm parameter

    Use the parameter name. This is the vm used according to the result of your message

    VM var = workflowToken.getInputParameters () .get ("vm");

    You can check for safety if the virtual machine is defined, except that the virtual machine is the required parameter

    If (vm! = null) {}

    return vm.name

    }

    The code snippet above you should return the value set for the parameter of the virtual machine.

    Hope this helps,

    Martin Marinov

  • How to use a String function Find() during a Test of a string value?

    Hello

    I intend to match a substring of the string returned by my USE when the use of a string value test - call of VI.

    I write the string returned for a string variable local (Locals.data_read) and tab limits - under the expected string value using Find (Locals.data_read, 'Connected'). When I check the expression to find errors - I get a warning "expected a string number found {comma floating 64}.» This value will cause a runtime error. »

    What Miss me?

    Thank you

    Kech

    Here is an example showing both.

  • Save the alphanumeric string value

    Hello!
    How to save a value to a variable so that I can use it in the future? I have a string of output of a case structure proposed by an OK botton. I want to save the string value when I press the ok botton...
    Thanks in advance
    GM

    Just write the string in a text file.  When you want to use it later, to read the text file.

  • Have to reset the flag of string value

    Hello everyone

    I'm trying to reset the flag of string value.

    I use node string indicator property to change the color, its evolution, but when the program runs again it should start default how to do it. Thanks in advance

    Here, it's in 2009

  • Put the string value in a table

    Hello

    Probably an easy question, but I am reading data of a RFID reader that returns a string value of 12 bytes. Whenever a RFID reads, I want the tag to be inserted in a string table on the front panel. So, basically, a newspaper of the each tag [read-> Insert row 0] then [read-> Insert level 1] and so on. I work RFID reader, I don't know how to put the string in the table.

    I'm not sure of the steps necessary to achieve control of the table (or if the table control is the right thing to use).

    Any help would be greatly appreciated. Thank you.


  • Switching between 2 string values

    It is probably a trivial question, but how to move between 2 string values to send to an entry of a larger chain of concatonated function. The values need to be changed every 100ms or so.

    Thank you

    mhaque

    You're right, it is trivial.

    Best regards

    Balze

    P.S.: Attachment VI LV2009

  • Could not save the different string value to each element of the array

    I have a configuration of VI to read several channels Veristand project.  The entrance is a table 1 d of channels, (an element for each channel, I want to read).  The channels have different names, each of the elements in the chain must be different.  I am able to edit each item and run the VI, and it works fine.  However, if I save, close and reopen the VI, all elements show the same value (what happens to the value of the last element for which I defined a default value).  Is this behavior planned, or have I missed a configuration setting which would allow different string values?  Please notify.  Thank you.

    GSinMN

    Make sure that you select the table and not only one item when you right click-> set by default on the front panel.

  • Can I pass a string value to a double digital display?

    I do a test sequence and save each test datas. When I get around one of the tests, I need the string value "BP" to be saved (in double digital indicator) for this particular criterion. Is there a possible way to do it?

    Maybe just use "NaN" instead of "BP". You can store a NaN in the digital indicator.

  • How to store the query string value in the scope of the session in webcenter spaces?

    Hello

    I want to store the query string value (which is given from URL) in the sessionScope variable. According to the value of sessionScope beacause I went some components inside my taskflow. Can someone help me how to store this value in the scope of the session. I use webcenter spaces for my application development.

    Thank you

    Ashok.

    Please see the article below

    How to pass a parameter of argument the query URL to a parameter input workflow? (Doc ID 1545808.1).

  • comparing string values in the same table

    I have a table with ID (14 digit string values) starting with "A". Ex: A21849B1020792. There may be a different ID with the same substring 'B1020792' in the same table, example: A12349B1020792. If this happens, the ID of the last creation date of must be returned in the result. In other words, comparison is done on the same table. "In the example provided, say A12349B1020792 has the date of 1 January 2015 'and A21849B1020792 has date February 1, 2015", since A21849B1020792 has the most recent date, the result must contain only A21849B1020792.

    ID create_date

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

    A21849B1020792 02/01/2015

    A12349 B1020792 01/01/2015

    A12345B1234567 01/03/2015      

    A43567B1234567 01/04/2015      


    Here's the query I used:

    substr (a.id, 7) select sc, max (a.create_date) cd1

    of table a, table b

    where a.id! = b.id

    and substr (a.id, 7) = substr (b.id, 7)

    and a.id like 'A %' and b.id like 'A %' / * (I used a % because I am interested only IDs that begin with A) * /.

    and a.id ('A12349B1020792', 'A21849B1020792','A12345B1234567 ','A43567B1234567')

    Group of substr (a.id, 7);

    Result:

    ---------

    sc                    cd1

    ---                    ------

    B1020792 02/01/2015

    B1234567 04/01/2015

    There is one thing that I'm not able to do with my request, that is, be able to get real IDs list and not list of substrings. If I added a.id column in the select clause and the group by clause, the query includes both by substr (a.id, 7) and a.id and as a result, the query returns four lines as below:

    substr (a.id, 7) select sc, max (a.create_date) cd1, a.id ID

    of table a, table b

    where a.id! = b.id

    and substr (a.id, 7) = substr (b.id, 7)

    and a.id like 'A %' and b.id like 'A %' / * (I used a % because I am interested only IDs that begin with A) * /.

    and a.id ('A12349B1020792', 'A21849B1020792','A12345B1234567 ','A43567B1234567')

    Group by substr (a.id, 7), a.id.

    Result:

    ---------

    sc                    cd1                      ID

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

    01/01/2015 A12349B1020792 B1020792

    B1020792 01/02/2015 A21849B1020792

    B1234567 01/03/2015 A12345B1234567

    B1234567 01/04/2015 A43567B1234567


    My goal is to retrieve a list of all the unique identifiers that have the later dates.


    ID:

    ---

    A21849B1020792

    A43567B1234567


    Thanks for your time in advance!

    Hello

    user11951344 wrote:

    I have a table with ID (14 digit string values) starting with "A". Ex: A21849B1020792. There may be a different ID with the same substring "B1020792" in the same table, example: A12349B1020792. If this is the case, the ID of the last creation date must be returned in the result. In other words, comparison is done on the same table. "In the example provided, say A12349B1020792 updated 1 January 2015 ' and A21849B1020792 a date February 1, 2015", as A21849B1020792 has the most recent date, the result should contain only the A21849B1020792.

    ID create_date

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

    A21849B1020792 02/01/2015

    A12349B1020792 01/01/2015

    A12345B1234567 03/01/2015

    A43567B1234567 01/04/2015

    Here's the query I used:

    substr (a.id, 7) select sc, max (a.create_date) cd1

    of table a, table b

    where a.id! = b.id

    and substr (a.id, 7) = substr (b.id, 7)

    and a.id like 'A %' and b.id like 'A %' / * (I used a % because I am interested only IDs that begin with A) * /.

    and a.id ('A21849B1020792', 'A12345B1234567', 'A12349B1020792', 'A43567B1234567')

    Group of substr (a.id, 7);

    Result:

    ---------

    sc                    cd1

    ---                    ------

    B1020792 02/01/2015

    B1234567 01/04/2015

    There is one thing that I am not able to do with my request, that is, the ability to retrieve the list of IDs real and not a list of substrings. If I added a.id column in the select clause and the group by clause, the query groups according to the two substr (a.id, 7) and a.id and as a result, the query returns four lines as below:

    substr (a.id, 7) select sc, max (a.create_date) cd1, a.id ID

    of table a, table b

    where a.id! = b.id

    and substr (a.id, 7) = substr (b.id, 7)

    and a.id like 'A %' and b.id like 'A %' / * (I used a % because I am interested only IDs that begin with A) * /.

    and a.id ('A21849B1020792', 'A12345B1234567', 'A12349B1020792', 'A43567B1234567')

    Group by substr (a.id, 7), a.id.

    Result:

    ---------

    sc                    cd1                      ID

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

    B1020792 01/01/2015 A12349B1020792

    B1020792 02/01/2015 A21849B1020792

    B1234567 03/01/2015 A12345B1234567

    B1234567 01/04/2015 A43567B1234567

    My goal is to retrieve a list of all the unique identifiers that have the later dates.

    ID:

    ---

    A21849B1020792

    A43567B1234567

    Thanks for your time in advance!

    If it makes sense to treat the first 6 characters of the ID separately from the rest of the id in this problem, maybe it makes sense to store those two parts of the id in two different columns.  Relational databases work best when each column of each row contains 1 single piece of data (at most).  It is so fundamental to the design of table that he called the first normal form.

    Given that the two parts are stored in column 1, so you can something like this Request Top - N:

    WITH got_r_num AS

    (

    SELECT r.id

    r.create_date AS cd1

    , RANK () OVER (PARTITION OF SUBSTR (r.id, 7))

    ORDER BY r.create_date DESC

    ) AS r_num

    FROM table_x g - g for data values

    JOIN table_x r - r for related values

    ON SUBSTR (r.id, 7) = SUBSTR (g.id, 7)

    WHERE g.id IN ('A12349B1020792'

    , "A21849B1020792".

    , "A12345B1234567".

    , "A43567B1234567".

    )

    - AND g.id LIKE 'A %' - if necessary.   The above condition ensures already g.id start with "A".

    AND r.id LIKE 'a % '.

    )

    SELECT id, create_date

    OF got_r_num

    WHERE r_num = 1

    ;

    If you would care to post CREATE TABLE and INSERT instructions for the sample data, and then I could test this.

  • Creation of Contact the PHP export leads to failure: field 'name' must be a string value.

    Hello

    I export contacts from Eloqua to my application using the API as a whole. I am stuck at a point where I'm creating export based on my maps of fields as follows:

    GET .../contact/export

    {'name' ": example","secondsToRetainData": "3600", "fields": {"C_EmailAddress": "{{Contact.Field (C_EmailAddress)" "}}" "}}

    and the server returns an error:

    {"failures": [{'field': 'name', 'coercion': 'Must be a string value, at least 1 character and a maximum of 100 characters long.'}, {'field': 'fields', 'coercion': 'Required.'}]}

    In order to ensure that my JSON string is syntactically correct, I copied (very useful) application at http secure.eloqua.com/api/docs/Dynamic/Bulk/1.0/Export.aspx and run it through the server, which results in the same error.

    I suspect that Eloqua does not recognize parts of my application as a string payload. I use PHP to build a table that is then encoded using json_encode(). All the world has known this before and found a solution? Please share!

    Wouter

    OK, my next wag: is the Content-Type header?  It must be set to application/json.  Who met with some of the calls.

    .  Topher

  • Reg: Split string

    Dear all,

    Oracle Database 11g R2 11.2.0.1 SE1

    Consider the string

    Madhu, no. 34 Church street, main road, TMK

    I need to trim the string based on the conditions below.

    Condition 1: Split string 35 characters each

    Condition 2: Search until the previous by commas and visualize up to comma.

    Condition 3: split to then 35 characters.

    Power required for the highest chain

    Addr1 Addr2
    Madhu, no. 34 Church streetmain road, TMK

    Comment:

    Condition 1: Addr1-> 35 char = Madhu, no. 34 Church street, main ro

    Condition 2: Addr1-> comma previous search-> out-> Madhu, no. 34 Church street

    Condition 3: Addr2-> search for then 35 characters (i.e. "main road")-> 1-> Condition 2 Condition

    Please help in this regard.

    What's easier:

    with t
    as
    (
    select 'Madhu, No 34 Church street, main road, TMK' addr
      from dual
    )
    select substr(addr, 1, instr(addr, ',', -(length(addr) -35)) - 1) addr1,
          substr(addr, instr(addr, ',', -(length(addr) -35)) + 1, 35) addr2
    from t
    
  • Check the string value when using xdoxslt

    Hello

    I'm new to the BEEP and will have questions in writing this simple code for a model RTF. In plain language, that's what I want to do:

    If (instr(FirstName,'concern',0) > 0 and instr(LastName,'concern',0) > 0 and instr(MiddleName,'concern',0) > 0) then the VNAME variable value "

    on the other

    If (instr(LastName,'1-',0) > 0), then set VNAME variable FirstName

    on the other

    the value of VNAME variable FirstName + "" + name

    Finally... show the VNAME variable

    ===========

    I wrote it, but it doesn't work:

    declared variable... Initialize it to x.

    <? xdoxslt:set_variable($_XDOCTX,_'v_RTPMName',_'x')? >

    String value of control-> - error.

    <? If: (xdoxslt:Instr (lower(coFirstName|| coMiddleName || coLastName), "abuses", 0) > 0)? >

    <? xdoxslt:set_variable($_XDOCTX,_'v_RTPMName',_'')? >

    <? end if? >

    write the variable

    <? xdoxslt:get_variable($_XDOCTX,_'v_RTPMName')? >

    Thanks for the help!

    For a quick overview,.

    InStr is belong to the xdofx family, must be used in this way instead of xdoxslt:Instr()

    For example: If condition 1 0 otherwise true back

    0 then 1 or 0 end if? >

Maybe you are looking for

  • My e-newsletter is not formatted correctly in firefox

    I use a service called Sendgrid e-mail. Recently, I created newsletters that appear perfectly in other browsers such as Google Chrome, Internet Explorer, Safari. However, the newsletter is completely distorted when using Firefox. If you please advise

  • Satellite A300-15J: Vista x 64 Card reader driver problem

    Hello I have a problem with the driver for my internal card on my laptop (Toshiba A300-15J) reader and I use Vista x 64 system.I am really lost, just tried to add, for almost every driver possibble to many other copanies, I'm looking for help here. I

  • Photosmart 7520: Cannot find my scans on computer since installing Windows 10

    Since I've upgraded to Windows 10, my printer scans but I can't find the scans on my computer. There seems to be no way to put the scans I would.

  • Re: Mac and HP 8500 duplex printing has

    I have exactly the same problem. I have reset the printing system, installed the drivers and created a "Preset". Yet, I must go to the menu settings/options to check the 'duplex' box AGAIN EVERY time in all applications.  I would appreciate a fix. I

  • Pavilion G6 1334sa: updated Dvd Blu Ray player

    HelloThis laptop came with a standard dvd player, but I was wondering if it was possible to upgreade it has a blu Ray drive? And if yes, what were the numbers of room and other things because there are a lot of different there hope someone can help T