Strip column values, set the new column

I'm on 11G, need help with SQL.

I would like to use RegEx, I know 11G supports up to 5 functions, I think maybe REGEX_LIKE, not sure, let me explain.

I have a VARCHAR2 column in my Table which can have different combinations of values:

Example #1:
value (with or without spaces, I call this value0, without a delimiter), example:

Send
Infocourriel
WhiteSpace
More examples

value0 band where no delimiter is used in its own column




Example #2: (values separated by a delimiter <), example:

Gucci < watches < accessories
blah < blah < blabla
blah < blah #$ < blabla

so, I call these:

Value1, value2, value3

band value1 before 1 < in its own column
band value2 before the 2nd < in its own column
remove the 3 value after the 2nd < in its own column

The good thing is that when the separator is used, it is consistent, there are 2 of them: value1, value2, value3

Thank you.

Hello

Whenever you have a problem, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables.
Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
If you ask on a DML statement, such as UPDATE, CREATE TABLE and INSERT statements need to re - create the tables as they are before the DML, and results will be the content of the or the tables changed when it's all over.

Looks like you want something like:

UPDATE     table_x
SET     value0     = CASE
                WHEN  INSTR (value, '~')     = 0
                THEN  value
            END
,     value1     = CASE
                WHEN  INSTR (value, '~')     > 0
                THEN  TRIM ( REGEXP_SUBSTR ( value
                                           , '[^~]+'
                               , 1
                               , 1
                               )
                     )
            END
,     value2  = TRIM ( REGEXP_SUBSTR ( value
                                   , '[^~]+'
                           , 1
                           , 2
                           )
                 )
,     value3  = TRIM ( REGEXP_SUBSTR ( value
                                   , '[^~]+'
                           , 1
                           , 3
                           )
                 )
;

You could use instead of INSTR REGEXP_LIKE, but is not really easier to code, and it will be less effective.

Published by: Frank Kulash, Sep 20, 2011 17:15
This site interprets the < signs such as markup, so I changed the delimiter to ' ~', just to make it clear. You must use < I used ~ above.

Tags: Database

Similar Questions

  • How to set the new tab to open a homepage

    After the recent update to version 44.0.1 I lost the ability to open a new tab and open the new tab homepage. Someone can help me.

    Thank you

    Do you mean when you open a new tab, you want to see your regular home page instead of the page of the new integrated tab on Firefox?

    41 of Firefox is no longer uses the browser.newtab.url setting in about: config because he was constantly attacked by malware. From 41 of Firefox, you need an add-on to change the new tab page.

    Here are a few options (I'm learning more all the time):

    • If you are already using the "Restorer of classic theme" or "Tab Mix Plus" extension: There is an option somewhere (!) in his dialogues of the parameters to select another page in the new tab.

    Use only one of these methods at the same time, otherwise there may be conflicts and dysfunctions.

    Setting up substitute new tab and new tab custom

    After installing one of these extensions, you must use the Options page to set the new desired tab page (instead of use subject: config).

    Open the page modules using either:

    • CTRL + SHIFT + a (Mac: Cmd + shift + a)
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click Extensions. Then on the side right, find the new tab replace or custom new tab and click on the Options button. (See first screenshot attached).

    New tab Override

    Depending on the size of your screen, you may need to scroll down to enter the address in the form. (See second screenshot attached). For example:

    • (Default) page thumbnails = > subject: newtab
    • Blank tab = > subject: empty
    • Built-in Firefox homepage = > topic: welcome
    • Any other page = > full URL of the page

    Then tab or click this form field and you can test using Ctrl + t.

    Custom new tab

    It is easy to enter your favourite homepage address. If you check either of the boxes, the expansion will set the focus in the page as well, for example, the cursor will be in the Google search box. (See third screenshot attached). I had to leave Firefox and start it up again before new custom tab started working, but this may have been due to tests so many extensions back to back.

    Success?

  • Get the old value and the new value based on the date

    Hello

    I have a table called list created below with the rest of the insert statements.

    CREATE TABLE ROSTER
    (
    NUMBER OF ROSTER_EMPLOYEE_DEF_ID
    NUMBER OF EMPLOYE_ID
    NUMBER OF DEFINITION_REGION_CODE
    NUMBER OF DEFINITION_DISTRICT_CODE
    NUMBER OF DEFINITION_TERRITORY_CODE
    START_DATE DATE,
    END_DATE DATE
    )



    INSERT IN THE LIST
    (ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
    VALUES
    (1,299,222,333,444, 'JUNE 1, 2011', 30 JUNE 2011 "")

    INSERT IN THE LIST
    (ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
    VALUES
    (2,299,223,334,445, "1 JULY 2011', JULY 20, 2011" "")

    INSERT IN THE LIST
    (ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
    VALUES
    (3,299,224,335,446, 'AUGUST 1, 2011', AUGUST 30, 2011 "")

    INSERT IN THE LIST
    (ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
    VALUES
    (4,300,500,400,300, 'JUNE 1, 2011', JUNE 20, 2011 "")

    INSERT IN THE LIST
    (ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
    VALUES
    (5,300,501,401,301, "1 JULY 2011', JULY 20, 2011" "")


    In the table above we have columns like

    EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE

    The result I'm looking for the table above is based on the employe_id OF start_date AND end_date

    I need to get the OLD_DEFINITION_REGION_CODE and the NEW_DEFINITION_CODE
    Similarly, OLD_DEFINITION_REGION_CODE and the NEW_DEFINITION_REGION_CODE
    and OLD_DEFINITION_TERRITORY_CODE and the NEW_DEFINITION_TERRITORY_CODE


    I need to get a row of data for each employee saying old value and the new value

    for the employee 299 there are 3 records he puts the new record which is the latest date is to say beginning August 1, 2011 and end date of recordings old 30 August 2011
    beginning July 1, 2011 and July 20, 2011


    For the data in the table above, I need to get the data as below


    EMPLOYE_ID OLD_DEFINITION_REGION_CODE NEW_DEFINITION_CODE OLD_DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE START_DATE END_DATE
    299 223 224 334 335 20 JULY 11 30 AUG 11
    300 500 501 400 401 20 JUNE 11 JULY 20, 11


    Please suggest me to get the result above, based on the data. Please let me know if my messages are not clear


    Thank you
    Sudhir
    SELECT  EMPLOYEE_ID,
            OLD_DEFINITION_REGION_CODE,
            NEW_DEFINITION_REGION_CODE,
            OLD_DEFINITION_DISTRICT_CODE,
            NEW_DEFINITION_DISTRICT_CODE,
            OLD_DEFINITION_TERRITORY_CODE,
            NEW_DEFINITION_TERRITORY_CODE,
            START_DATE,
            END_DATE
      FROM  (
             SELECT  EMPLOYEE_ID,
                     ROW_NUMBER() OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE DESC) RN,
                     LAG(DEFINITION_REGION_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_REGION_CODE,
                     DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE,
                     LAG(DEFINITION_DISTRICT_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_DISTRICT_CODE,
                     DEFINITION_DISTRICT_CODE NEW_DEFINITION_DISTRICT_CODE,
                     LAG(DEFINITION_TERRITORY_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_TERRITORY_CODE,
                     DEFINITION_TERRITORY_CODE NEW_DEFINITION_TERRITORY_CODE,
                     LAG(END_DATE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) START_DATE,
                     END_DATE
               FROM  ROSTER
            )
      WHERE RN = 1
    /
    
    EMPLOYEE_ID OLD_DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE OLD_DEFINITION_DISTRICT_CODE NEW_DEFINITION_DISTRICT_CODE OLD_DEFINITION_TERRITORY_CODE NEW_DEFINITION_TERRITORY_CODE START_DAT END_DATE
    ----------- -------------------------- -------------------------- ---------------------------- ---------------------------- ----------------------------- ----------------------------- --------- ---------
            299                        223                        224                          334                          335                           445                           446 20-JUL-11 30-AUG-11
            300                        500                        501                          400                          401                           300                           301 20-JUN-11 20-JUL-11
    
    SQL>  
    

    SY.

  • How to add a transient attribute of a table values in the new attribute group wise transient that is to say wise customer?

    Mr President.

    How to add a transient attribute of a table values in the new attribute group wise transient that is to say wise customer?

    as below

    custwisevalue.png

    Concerning

    Hello world

    for an overview in the following form

    This is the sql query that reach this format

    SELECT c.name customer_name,
            p.name product_name,
            sl.sal_qty,
            sl.unit_sal_price,
            sl.sal_qty*sl.unit_sal_price AS salesvalue,
            CASE
              WHEN ROW_NUMBER () OVER (partition by c.cust_id order by p.prod_id desc,sl.sal_id desc) = 1 THEN
                  SUM (sl.sal_qty*sl.unit_sal_price) OVER (PARTITION BY c.cust_id)
            END totals
    FROM customer c INNER JOIN sales s ON s.cust_id = c.cust_id
    INNER JOIN salesline sl ON sl.sal_id = s.sal_id
    INNER JOIN product p ON p.prod_id = sl.prod_id
    ORDER BY c.cust_id,p.prod_id,sl.sal_id
    

    Cheers and enjoy

    Respect of

  • I just updated my indesign to CC of CS5. One thing I notice which is annoying is some text boxes and images go live. For example, if you close a text box in CS5 you close the box you see reformat the text to set the new size. In the tex CC

    I just updated my indesign to CC of CS5. One thing I notice which is annoying is some text boxes and images go live. For example, if you close a text box in CS5 you close the box you see reformat the text to set the new size. In CC, the text does not reformat until you are done change the size of the box. It's the same for the images when resizing or rotation re. You don't know what you have until its finished. If you are a little guess instead of see what you're doing while. Is there a way to change this, or does anyone else have this problem. Maybe it's just what does CC. But I'm not a fan... Can anyone help?

    When using the image processing manages, click... for a while... then drag...

  • A link is not set the new value of page elements

    I work in the Application Express 4.1.0.00.32 in my 223 Page I have a "SQL query" region: select * from (SELECT...             '' link_obstr_attgov,... De........ When I run the page, the "link_obstr_attgov" link seems to work, for example a line produces this link: http:// say mysite.it/html/f? p = 207:225:440911817290726:P223_ROWID_PIANO_EDIT, P225_P_UFFICIO, P225_P_DATA_DAL, P225_P_DATA_AL, P225_p_versione:AABHjqAAHAACAO0AAD, 10AA, 01/01/2015,31/12/2017,1 my problem is that when Page 225, P225_P_UFFICIO elements P225_P_DATA_DAL, P225_P_DATA_AL, P225_p_versione have no value. Any help?

    Francesco wrote:

    (Sorry, I don't know the syntax highlighting feature again, next time I'll try to use)

    I worked initially with the integrated declarative column binding feature and it worked fine, but now my problem is that the value of a certain value of the column in the row, the navigation should move to-let's say - "page one" or "page b", so I would use "CASE...". WHEN"in the report query.

    How the different options regarding the parameters involved are? If they are similar partial substitutions can be used in the connection of the declarative column. Determine the page target in the logic of the query:

    select
        ...
        case ...
          when ... then '225'
          else '226'
        end page
    ...
    

    and use the value of the page in the link URL column:

    f?p=&APP_ID.:225:&SESSION.::&DEBUG.::P223_ROWID_PIANO_EDIT,P#PAGE#_P_UFFICIO,P#PAGE#_P_DATA_DAL,P#PAGE#_P_DATA_AL,P#PAGE#_p_versione:#P223_ROWID#,#EMPNO#,#HIREDATE#,#HIREDATE#,#SAL#
    

    Separation concerns and use declarative functionality is the approach in the APEX. A bit of lateral thinking is often useful.

    Otherwise, URL encode all values of parameter as described above:

    '  link_obstr_attgov
    
  • dialog box closed = &gt; refresh LOV = &gt; set the new value

    Hello

    I'm really struggling with the following problem. I want my users to pick up existing customers or create a new if it does not exist. So I have a form (P1), a form is LOV with existing customers and a "Create new customer" button next to the LOV that calls the form of the modal dialog box (P2), where the new customer can be added.

    In the P2 process customer's line is an option to return an item, so I return it to P2_CUSTOMER_ID (which is my primary key element). On P1, I created the dynamic action:

    Event: Dialog closed

    Selection type: button

    Button: AddCompany

    and there are 2 real actions.

    (1) item discount P1_CUSTOMERS_LOV

    (2) set

    Type: Dialog box return

    RMA: P2_CUSTOMER_ID

    Affected items = > product (s): P1_CUSTOMERS_LOV

    LOV customers is refreshed correctly but the value is not set. What is even more surprising, it's that if I "insert" another action between these two (run code alert javascript ("added customer");), the new value is set correctly as planned.

    I really have no idea of what Miss me, and any help would be highly appreciated.

    Kind regards

    Pavel

    Pavel,

    I could make it work with a Select list. See once more your example. There is a dynamic onload action using

    $("#P2_CUSTOMER_ID").bind ("apexafterrefresh", function() {}

    $ ('#P2_CUSTOMER_ID') .val ($ (' #P2_CUSTOMER_ID_H ') .val ());

    });

    then, who is only triggered if the refresh of the selection list is completed.

    Denes Kubicek

  • &lt; af:valueChangeListener &gt; sets the new value back to the old value

    Hi people,

    I'm trying to implement a search bar with < af:inputText > and < af:selectOneListbox >.

    When the user selects an item in the listbox control, the inputText will be updated. After hitting the "ENTER" key, the search action will be taken.

    The valueChangeListener will be called when the selection of items in the listbox.

    The problem can be described by the following two cases:

    (1) the user types something in the inputText box and hitting 'ENTER' key for a search. The valueChangeListener is called and sets the value of the string user typed.

    (2) the user selects something in the list box, each time changes the selection in the listbox control, the valueChangeListener will be called. But when the user presses the "ENTER" key, the valueChangeListener is still called, and it sets the return value to the old value. For example, the list has 'a ', ' b', 'c '. The user selects 'a', then 'b '. After hitting the "ENTER" key, the value in the inputText is replaced with "a".

    The code is as follows:

    Code in .jspx:

    < af:inputText value = "#{pageFlowScope.word} '"

    autoSubmit = 'true' immediate = "true".

    valueChangeListener = "#{pageFlowScope.update}" / >

    < af:selectOneListbox valuePassThru = "true" >

    < f: selectItems value = "#{pageFlowScope.items}" / >

    < / af:selectOneListbox >

    Bean managed code:

    publicvoid update (ValueChangeEvent event) {}

    This.Word = event.getNewValue (m:System.NET.SocketAddress.ToString ());

    }

    I don't know how the valueChangeListener behaves like that.

    Could someone provide me with clues or tips?

    Thank you

    Carl

    Carl, tell us your version of jdev, please!

    There is something wrong in your implementation. I do not see an inputText field who's value stored in a variable pageflowscope "word". This field has an attached valuechangelistener which is obsolete, because the field already stores its value in the variable pageflowscope. The same that you are trying to do in the valuechangelistener. So I don't see a selectonelistbox which does not store the value selected anywhere because it doesn't have the value property for it. There isn't an attached valuechangelistener so I wonder how your valuechangelistener is called at all when you change the selectoneListBox.

    Timo

  • long integer value - setting the date of entry

    Hello

    I'll send a calendar event while recording up to a database on my server.

    When I retrieve this entry and try to rebuild the entrance on the device, I have problems with starttime and endtime.

    I use Long.parseLong (myStartTime) (in order to define the start time of the new entry) and get a number format exception.

    So after struggling to find a solution, I tried to manually set for the tests.

    myStartTime = 1283778000000; This is the beginning of the time value of the downloaded

    I get the whole number too big.

    Someone at - he also experienced difficulties affecting a schedule start time entry like this?

    Please can someone offer a suggestion?

    Thank you Alex

    Have you tried just Long.parseLong (String)? Who will use the base 10. (Or you can specify 10 as the radix).

  • set the new tab to open AGAIN homeVersion 43.0.1 breaks new tab homepage

    I don't know why the development team is so God awful ready on forcing me to use this terrible miniature of the previous pages as the new screen of the tab, but it SUCKS. I use FF because I don't want to be forced to use my browser as I want it to work. Correct this flaw and I would like to give the new tab homepage. 43.0.1 broke the new tab override add on which historically corrected this weakness / FF stock.

    Can I assume that your real problem is that the extension new tab replace does not work in Firefox 43?
    based on your similar thread in September - https://support.mozilla.org/en-US/questions/1084993#answer-784907

    The developer of this add-on is aware that it is broken - https://addons.mozilla.org/en-US/firefox/addon/new-tab-override/reviews/769315/ - and says he'll fix it.

    "The nature of the lack of the new tab should be without a doubt, opening to what the user has defined for its home page".

    You are entitled to your opinion on that, but Mozilla feels differently about what the default should be for the new tab.

    My opinion [that does not count be] is that it would be ridiculous to have all of the users 'Homepage' to be the default value for the page tab. How would this work when a user like me has two home pages? Two new tabs open all the time? Or complicate the issue and only open the first home page for the new tab instead?

  • Firefox android opens about.config homepage. Failed to set the new homepage

    Firefox android open always new tab or browser session about: config page.
    I restarted browser and Tablet (Samsung Galaxy Tab 3), and this behavior has not changed.
    All google searches suggest that the firefox browser android home page is not editable, but this is obviously not true.
    I tried the solutions that suggest to navigate to about: home and edit bookmarks and these paths do not work.
    The awesome bar is far from great.
    How to stop the browser from the start to about: config and how can I make the homepage be what I want?

    Solution found:
    Any time by the shortcut of firefox in the section at the bottom of my home screen Quick Launch I got about: config

    Whenever the opening of new tabs for navigation, I got about: config

    I removed the shortcut to quick launch firefox and entered the apps and the firefox shortcut added to quick launch

    The new shortcut follows my customization settings and opens to the best sites now, but also the new tabs to open up to the best websites

    Of course, there is a way to set a homepage of a shortcut somehow

    Unfortunately, this tablet was working properly at the time of purchase and I don't know how to change shortcuts yet, but they can be changed

  • I want to learn how to set the new tab page to load at startup of firefox (as the homepage only).

    I want to put the new section as my home page. In other words, I want to show him when I open firefox and when I click on the home button. I don't know if it's in the current scope of firefox.

    First update for Firefox 19.0.2 Firefox updated to the latest version

    Then, in the home page option box, set your home page to about: newtab. This will open the page of the new tab as your homepage.

  • How can I set the new tab to open like a blank page?

    I tried "how to turn the page on the new tab off?" in https://support.mozilla.org/en-US/kb/new-tab-page-show-hide-and-customize-top-sites

    But still the new tab opens with (chrome://quick_start/content/index.html' "Quick start" and the words "Snap Deal" is already entered in the search bar.) See the capture screen.
    I need a blank page displayed when a new tab is opened.

    Unless this is possible, I spend my default browser.

    Thanks for the reply jscher2000.
    After posting the question, I uninstalled Firefox and then download new and installed. Still the problem remained.
    After about 2 hours I still once uninstalled, downloaded again and installed.
    This time it worked perfectly as before.
    So, now I don't have the problem.
    Thank you.

  • computer everything stops randomly after setting the new monitor

    recently, I had my screen replaced as she had been struck on the cracked floor but since I got back my computer keeps randomly cutting and when I restart I am prompted to repair as it says that my computer was not able to start so I do and it says it could be due to a recent material added. It is as if the computer has a built in Cup do you think it is due to the installation of the new screen or is it just a coincidence? Although he did not he whilsti have been here and I started with the mode safe mode with internet?

    Hello

    Safe mode does not focus on the machine anywhere near as much as that of Windows. It certainly seems to
    be tied down, the repair and new screen or both.

    Take it back to the one who did the repair screen and have them repair it properly. Or take it to a real computer
    living room (not of leeks and glances at a Best Buy or other department stores) or system manufacturer support.

    I hope this helps.
    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • Update the column values with the new user who has changed the data in the current line

    I have a table, the following structure.

    CREATE TABLE FILTERCALENDAR1
    (DATE OF THE "C_DATE',
    NUMBER (1,0) 'DAY_OF_WEEK ',.
    NUMBER (1.0) "WEEK_WINDOW."
    NUMBER (1.0) "MONTH_WINDOW."
    NUMBER (1.0) "YEAR_WINDOW."
    NUMBER (1.0) "DATE_YEAR_WINDOW."
    NUMBER (1.0) "ONCE_WINDOW."
    VARCHAR2 (25 BYTE) "USERNAME."
    "LASTUPDATED" DATE
    );

    Problem:
    If a user changes the value of one of the columns I want to write his name to user and sysdate in the 'USERNAME' and LASTUPDATED' columns.

    * Tried: *.
    I tried an update trigger for this problem, but I get an error table mutation.

    The one you suggest how can I achieve this.

    Concerning

    Use BEFORE the UPDATE trigger

    CREATE OR REPLACE TRIGGER myTrigger
    before UPDATE ON FILTERCALENDAR1 FOR EACH ROW
    BEGIN
    :new.USERNAME := user;
    :new.LASTUPDATED := sysdate;
    END;
    

Maybe you are looking for

  • Equium A80: Missing BIOS download

    Salute to the United Kingdom, and toshiba Europe sites not BIOS update for satellite A80 return in the past, I have found the BIOS dates here, everyone knows where they are?

  • Y700 - Dolby Audio does not work after resetting the system

    After resetting my computer to factory settings, audio dolby does not work. This is the error message I get: "Your installation is missing components. Reinstall the audio driver or the stand-alone components available on the support site for the manu

  • Software and HP w2007 monitor

    Hi people I have a HP w2007 monitor RK284AA. Initially the system startup appears a HP Display Menu that would allow me to choose the text mode, games, etc. that have changed the way in which the content of the screen. I only disabled the start menu

  • SSD not work / be detected - error Windows installation on laptop HP Dv6-1149wm

    Well, well, I tried three different nine ssd: 1 kingston v300 120 GB SSD, 2 840 120 GB ssd samsung, and 3 an another kingston v300 120 GB SSD. Tried in this order. The Kingston-discs Are not detected by the bios no error or nothing, nada. When it is

  • No sound from the laptop, unless I have plug in headphones

    It started today, actually. I did everything. Disabled/Re-the pilot's license, check the errors, troubleshooted, etc etc. Literally all of the measures to solve this problem has not worked.