change the values to a string and return

Hello
I need help to find the best way to perform a trinsformation on a field.

I got data such as:
 
text;moretext;ir-baoc|notActive|notInduced-01;ir-baoc|notActive|notInduced-02;andmore
ir-baoc|notActive|notInduced-01;ir-baoc|notActive|notInduced-02;andmore
text;moretext;ir-baoc|notActive|notInduced-01;ir-baoc|notActive|notInduced-02
ir-baoc|notActive|notInduced-01;ir-baoc|notActive|notInduced-02
text;moretext;andmore
I got this questioned:
select 
  NVL(SUBSTR(REGEXP_SUBSTR(CONCAT(';',srv_code_lst),';ir-([^;]*)-01'),LENGTH(';ir-')+1,LENGTH(REGEXP_SUBSTR(CONCAT(';',srv_code_lst),';ir-([^;]*)-01'))-7), ' ') as A,
  NVL(SUBSTR(REGEXP_SUBSTR(CONCAT(';',srv_code_lst),';ir-([^;]*)-02'),LENGTH(';ir-')+1,LENGTH(REGEXP_SUBSTR(CONCAT(';',srv_code_lst),';ir-([^;]*)-02'))-7), ' ') as B
from mysystem
that return results as:
"A","B"
"boic|notActive|notInduced","boic|notActive|notInduced"
"boic|Active|notInduced","boic|Active|notInduced"
"boic|notActive|notInduced","boic|notActive|notInduced"
"baoc|notActive|Induced","baoc|Active|Induced"
"boic|notActive|notInduced","boic|notActive|Induced"
I need to be like:
"A","B"
"boic-notActive","boic-notActive"
"boic-Active","boic-Active"
"boic-notActive","boic-notActive"
"baoc-notActive","baoc-Active"
"boic-notActive","boic-notActive"
Can someone help me on this?
I'll try to find a solution, but I have to do this transformation in 50 million lines and probably I won't find one with good performance!

Thank you
Ricardo Tomas
SQL> with t as (
  2             select 'text;moretext;ir-baoc|notActive|notInduced-01;ir-baoc|notActive|notInduced-02;andmore' srv_code_lst from dual union all
  3             select 'ir-baoc|notActive|notInduced-01;ir-baoc|notActive|notInduced-02;andmore' from dual union all
  4             select 'text;moretext;ir-baoc|notActive|notInduced-01;ir-baoc|notActive|notInduced-02' from dual union all
  5             select 'ir-baoc|notActive|notInduced-01;ir-baoc|notActive|notInduced-02' from dual union all
  6             select 'text;moretext;andmore' from dual
  7            )
  8  SELECT  CASE ';' || srv_code_lst
  9            WHEN A THEN ' '
 10            ELSE A
 11          END A,
 12          CASE ';' || srv_code_lst
 13            WHEN B THEN ' '
 14            ELSE B
 15          END B
 16    FROM  (
 17           SELECT  srv_code_lst,
 18                   REGEXP_REPLACE(';' || srv_code_lst,';(.*;ir-)([^|]*)\|([^|]*)(\|.*|-01)','\2-\3') A,
 19                   REGEXP_REPLACE(';' || srv_code_lst,';(.*;ir-)([^|]*)\|([^|]*)(\|.*|-02)','\2-\3') B
 20             FROM  t
 21          )
 22  /

A                              B
------------------------------ ------------------------------
baoc-notActive                 baoc-notActive
baoc-notActive                 baoc-notActive
baoc-notActive                 baoc-notActive
baoc-notActive                 baoc-notActive

SQL> 

SY.

Tags: Database

Similar Questions

  • Change the value of column select and insert different

    Hi all

    I've written a procedure where I am selecting values in other tables and inserting into a new table. The code is below
     
    If you see line 54 in the code, you will find the combined_bu_code is comes from a procedure and the value of BU is stored in prod. Table SEM_BACKLOG_LOG. I need to check, if the combined_bu_code came as PWR then insert as table BACKLOG_OTD_NEW POWER not as PWR.

    You are looking for assistance on this. Thanks in advance

    Concerning

    Published by: User_Apex on June 23, 2011 03:03

    Published by: User_Apex on June 23, 2011 03:53
    DECODE(SMTC_OTD_CHART.get_combined_bu_code(a.BU), 'PWR', 'POWER', SMTC_OTD_CHART.get_combined_bu_code(a.BU)) COMBINED_BU_CODE
    

    Kind regards
    Richard

    -----
    blog: http://blog.warp11.nl
    Twitter: @rhjmartens
    If you answer this question, please mark the thread as closed and give points where won...

  • Analyze the values to a string and then place in the lines

    Hi all

    I need help here. I have a field called document_desc. Below is a sample of its contents:


    Invoice: * 90104 * attachment document URL created in ArchiveLink content server. Number of
    attachments: 3 Document ID (s): * 4FB6EB9040000ACA813, 4FB6EB924C0A2A813 *.
    *, 4FB6EBB7000ACA813 * (s) URL :): http://xxxxxxxxxx
    I need to do 2 things here:

    1. I need to analyze the elements in bold. The number of values beginning with 4FB can vary. In this example, there are 3 of them, it could be one, there may be 10. However, they will be always between the ' ID (s):' and the ' URL (S):'

    Invoice number (901825004) will always be only one and the same position, but can have different lengths.

    2. I then need to format it so that it looks like:
    Invoice_Number        Archive_ID
    901825004               4FB6EB904C561491E1000000AC12A813
    901825004               4FB6EB924C561491E1000000AC12A813
    901825004               4FB6EBB74C561491E1000000AC12A813 
    Any suggestions?

    Published by: dgouin on May 29, 2012 11:25

    Published by: dgouin on May 29, 2012 11:26

    Published by: dgouin on May 29, 2012 11:27

    Published by: dgouin on May 29, 2012 11:27

    Published by: dgouin on May 29, 2012 11:33

    Hello

    Regular expressions a great help with this stuff:

    WITH     got_doc_id_list     AS
    (
         SELECT     x_id
         ,     REGEXP_REPLACE ( str
                          , '.*Invoice: *([^ ]+).*'
                          , '\1'
                          , 1
                          , 1
                          , 'n'
                          )     AS invoice
         ,     REGEXP_REPLACE ( str
                          , '.*Document ID\(s\):(.*)URL.*'
                          , '\1'
                          , 1
                          , 1
                          , 'n'
                          )     AS doc_id_list
         FROM    table_x
    )
    ,     cntr          AS
    (
         SELECT  LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= 10     -- Max number of doc_ids possible in one str
    )
    SELECT       d.x_id
    ,       d.invoice
    ,       TRIM ( REGEXP_SUBSTR ( d.doc_id_list
                                  , '[^,]+'
                          , 1
                          , c.n
                          )
                )    AS archive_id
    FROM       got_doc_id_list  d
    JOIN       cntr             c  ON  c.n  <= 1 + LENGTH (d.doc_id_list)
                                                - LENGTH (REPLACE (d.doc_id_list, ','))
    ORDER BY  x_id
    ,            c.n
    ;
    

    It works Oracl 10.1 (and higher). In Oracle 11, there are new features of regular expressions which can make it a little simpler.
    I guess that your data are pretty well trained. For example, I assume that there is always something (not counting the white spaces and commas) after ' ID of Document (s): "and before"URL", and that the ID never include the substring"URL"." If these assumptions are false, then the same basic approach will work, but the details are a little messier.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Point where the above query was to produce erroneous results, and explain, using specific examples, how you get these results of these data in these places.
    Always tell what version of Oracle you are using.

  • How to change the value of string clustered, to implement using the node value of property instead of writing directly on the flow of data or using the variable

    new to labview :-) and I have a problem when I want to change the value of a string in bunches, and I want to implement this using the node value of property instead of writing directly to the stream or by using the variable, enclosed is the picture.   No matter, I have change in cluster (control) or value of Popery out (indicator) cluster, the value (sensor 7) dataflow keeps unchanged even I gave the new value by value of property node. Thank you to give me some advice about this.

    Hi GerdW

    Thanks a lot for your answer. The reason I'm stubbornly tring to break the flow of DATA is: we have a test system that have about 100 screws, they have a few connected flow, some of them will be unbundling a cluster dataflow chain to check the value in order to make the different cases.  Now I want to insert user event by changing the control and influential cases during run time.

    As I initially uses a global variable (to control cases) instead of unbundle string data flow, it works well.  But then, I found there are a lot of screws that are using the string unbundle.  One of the 'lazy' means, I tried is to change the value via the property node (because that way, I did not need to find all the places where using the unbundle string and replace them with the global variable), then I noticed a problem with "dataflow", the value in the stream of cluster in fact will not be changed by changing the value of the property node.

    I did a test with VI simple (like the picture in last post), and after reading your advice, I tell myself that I need to understand the concept of "DATAFLOW" in labview, it seems that my "lazy" way can not work in this scenario.

    I have attached the criterion VI here, have you furthur suggestions on what I can do in this case?

    Mant thanks!

    Minyi

  • The compilation gets error 7 and return all my strings

    Hi, I'm updating of legacy code. It contains references to the paths that don't exist any more (mainly drives on the network).

    So I go through the program, and I Exchange each defective path (from the old M:\ or P:\ to the my laptop C:\).

    When I run the labview program, it works very well.

    However, when I compile the program restores the old paths and gives error 7 when I run the *.exe.

    The paths are strings in text boxes (controls).

    I tried to check the "include files as library" option in the build specification.

    Any ideas? IM using Labview 2012 and the original program comes from an earlier version.

    Hey,.

    you set the values in the default controls or just change the values?

    So just changed, mark the new default values with a right-click on the control-> data operations-> default font of the current value

    Kind regards

    CMW

  • How to choose the value of a string are numeric together and words of letters (for example, TEST)

    Hi all

    How to choose the value of a string are letters (for example, TEST) and all numeric...

    for example
    TEST 123456
    TEST 34567
    123456 ABCD
    1234 TEST
    TESTING 12345
    TEST 1@234$
    YOUR T 123456

    I want the results of the query as below.
    TEST 123456
    TEST 34567

    And I tried to use regexp_like in this case but without success. See the code below.
    SELECT * FROM TABLE WHERE regexp_like (Description, ' [TEST] % & [[: digit:]] + $');

    How can I do this, please answer.

    Thank you

    WF

    If you want to return only the rows that contain the string 'TEST', followed by zero or more space characters, followed by one or more digits?

    How about this:

    SELECT *.

    FROM my_table

    WHERE REGEXP_LIKE(description,'^TEST\s*\d+$')

  • Change the values of the cluster in while loop and in the face at the same time

    Hello.

    I have a little problem in a test program, that I'm working on. I'll try to simplify as much as possible. I have a cluster control that contains two controls A and B. I want to:

    1. switch to update the value of the command A a while loop
    2. allow the user to change the value of the B control through the face, while the loop is running

    To change the value of order in the while loop, I first get the cluster control cluster, update the value of the control for a way to group by name and finally rewrite the cluster in the cluster control.

    The problem is that if the user changes the value of the B control while control that is in the middle of the update, the new value of B control is lost because it was read before updating in the face. Is there a way to get around this?

    DennisBengs wrote:

    1. switch to update the value of the command A a while loop
    2. allow the user to change the value of the B control through the face, while the loop is running

    Then they do not belong in the same cluster.  They are disconnected obviously enough that they do not go hand in hand.

    Where it can get really complicated, it is that you're talking about the user and code changing the same cluster.  It is very dangerous and very difficult to manage.  You might be able to get there with a driving force.  But walk slightly, my friend.

  • Check box to change the value of the field and reveal hidden text

    Hello

    I need to change a value in a field when you press a checkbox

    the default value can be $ 10 in 'formfield1 '.

    But when the checbox is checked, the value of 'formfield1' must spend $ 8

    I also need a reval text function in "textfield2' of the text hidden to visible.

    Is it still possible to combine in a box?

    I found a code on the forum and changed it, but it does not work as expected, it affects the field, it shouldn't and it behaves a bit funny, here is the code to calculate.

    I also tried to change the value of Off to On, but who has not reversed the procedure than I hoped.

    Well its a start, maybe someone can understand a give me help on the way?

    ________________________________

    custom for the discount calculation

    var nDiscount = 2;

    name of the Sub total field

    var cSubTotal = "formfield1";

    name of the non-Discount checkbox

    var cbNonDiscount = "CheckBox1";

    default value for the non-Discount

    Event.Value = 10;

    see if the purchase is with discount or not non-Discount

    If (this.getField ("cbNonDiscount") .value == 'Off') {}

    Event.Value = this.getField ("cSubTotal") .value - nDiscount;

    }

    put an end to a custom calculation

    Ah, if you want the calculation to take place when the box is checked, use this:

    If (this.getField (cbNonDiscount) .value! = "Off") {}

    Instead:

    If (this.getField ("cbNonDiscount") .value == 'Off') {}

  • Is it possible to change the values of particular #define of the various controls in CVI.

    In my application, I have different panels to file single .uir. When I save the .uir file, I get the same values of #define for different controls in different panels. For this reason, I am not able to use these #defines block switch. Is it possible to change the values of #define according to my condition.

    Hi, a little more Wolfgang post. It is the combination of the Panel to manage and control the unique ID: as you know, you can load the same panel more than once, so even if you recover the full chain of PANEL_CONTROL you have duplication. items that exactly identifies a particular control in a particular group are the combination control panel manage AND panel_control ID.

    On the one hand which guarantees more flexibility to your application, you can design only a few panels and reuse them whenever you want, even having some of them loded several times in the same instant. On the other hand, as you have discovered, there is the possibility (Finally, almost certain) duplicated in your app ID.

    To resolve the problem of duplicated IDS you can act in two ways:

    1. If you know that no Panel is never loaded several timer in your application, you can retrieve the name of constant of Panel with GetPanelAttribute (panelHandle, ATTR_CONSTANT_NAME, string); and to distinguish between the name of constant, then switch between control ID

    2. If you happen to have duplicate panels you will need to store each panelHandles in the non-volatile variables, switch between them and then switch between the control ID

    An alternative might be to use Panel callbackData attribute and assign a significant value during the loading of the Panel, other callbackData finally from a control ID. Something like this:

    Loading panels:

    panelHandle = LoadPanel (0, "myfile.uir", PANEL1);

    SetPanelAttribute (panelHandle, ATTR_CALLBACK_DATA, (void *) 1);   Assign different callbackData in each instance

    During the failover between controls:

    void * cbkd;

    GetPanelAttribute (panelHandle, ATTR_CALLBACK_DATA, &cbkd);)
    Switch (cbkd (int)) {}
    case 1: / / elements of the PANEL1
    switch (command) {}
    case PANEL1_NUMERIC:

    your code here
    break;
    case PANEL1_STRING:
    your code here
    break;
    }
    break;
    case 2:
    // .....
    break;
    }

    One final note: it seems to me that all this is necessary in a very limited situation, where you have the same callback called on various panels/controls. Whenever the reminder is unique to a specific panel or controls on a single panel you don't need to work that way.

  • Change the value of a Boolean switch rocker during execution

    Hello world

    Is it possible to change the value of a switch to toggle Boolean during execution?

    I make a program where the user can switch a relay switch.  However, I want the program to replace the user input if a measured value exceeds a predefined threshold.

    The program below did almost what I want.  The major problem is that it if the measured value returns below the threshold, the relay will be awarded if the switch is set to 'true '.

    I would be very grateful for any suggestions to solve this problem!

    Regards, Martin

    Hi Martin & Asad,

    Well, the problem is even more easy to solve

    After cleaning example of Asad, remove this RubeGoldberg, put in some wait States and make a correct stop button I put in place the example...

  • Nodemanager: How to change the value of AdminURL in startup.properties

    In weblogic 10.3.6, when I start a server (FORMS) with the administration console, the startup.properties file is automatically filled. I want to change the value of AdminURL to use HTTPS instead of HTTP.

    The value of the field AdminURL seems to come from Mbean. How to change?

    Thank you for your help.

    Fabrice

    Hello again,

    I checked my point. Here is what I tried:

    • I created a simple environment with ssl enabled on managed servers admin and nodemanager
    • I open the administration console to https and started a server managed and noticed the AdminUrl value in the startup.properties file
    • The value remained in http
    • Then I disabled the listening from the administration console http port
    • Tried to start again the same managed server, without touching the startup.properties file
    • The https value is now properly taken
    • Additional verification steps:
      • I have reactivated the administration server http listening port (of course without disabling the https port!)
      • Restarted the server and noticed the AdminUrl value in the startup.properties file
      • The value returned back to http

    Conclusion: in the light of the foregoing, it seems necessary to disable http administration server listening port, in order to have the value desired for AdminUrl

    It will be useful,

    White

  • change the value of the location attribute in db jca file with the configuration file

    Hello

    How can I change the value of attribute of 'place' in the jca adapter db file by using the configuration level if possible?

    I have the database map file where the first two lines are:

    < name of the adapter-config = "getParty" = 'Database adapter' adapter wsdlLocation = "getParty.wsdl" xmlns =" " http://platform.integration.Oracle/blocks/adapter/FW/metadata ">

    < connection-factory location = ' ist/DB/CRP1"UIConnectionName ="crp1_apps"adapterRef =" "/ >

    ...

    I need to replace the configuration file

    EIS/DB/CRP1

    with

    EIS/DB/DEV

    but this isn't the case. I think that I am not referencing correctly but I don't know how he is correct, that I couldn't find examples for composites and wsdl content, JCA file.

    Please share the idea.

    Thank you

    Anatoliy

    Anatolly salvation,

    You can assign a new value to the property of JCA by using either the Ombudsman as BPEL.

    Pick click entitled value option and add the right attribute to the property JCA jca.db.DataSourceName.

    In BPEL will zoom click the invoke for the DB adapter, go to the Properties tab and add the right attribute to the property JCA jca.db.DataSourceName.

    (edit)

    If you want to use a configuration file to set the value, I suggest a BPEL property, the value can be replaced by using a configuration file and can be assigned to the JCA property using ora: getPreference ("prefName as string");

    When you use a mediator does not have a preference, and you can use a placeholder that you change when you compile the SCA composite. With ANT in combination with hudson, you can easily replace the value (hard) by the environment.

    See you soon,.

    Robert van Molken

    Specialist of the integration of Oracle

    Post edited by: robertvm

  • How to change the value of a color picker?

    Hi *.

    I am currently working on a small project and I would use the colorpicker. When I initialize the colorpicker, the widget is updated and displays the correct color, but when I try to change the value when running, nothing happens. I missed something?

    Thank you very much
     
    package javafx.tests.colorpicker;
    
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Insets;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ColorPicker;
    import javafx.scene.layout.StackPane;
    import javafx.scene.layout.VBox;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    
    public class ColorPickerChangeColor extends Application {
    
         public static void main(String[] args) {
              Application.launch(args);
         }
    
         @Override
         public void start(Stage stage) throws Exception {
    
              VBox vbox = new VBox();
              vbox.setPadding(new Insets(10));
              vbox.setSpacing(10);
              Button button = new Button("Press me.");
              final ColorPicker colorpicker = new ColorPicker(Color.BLUE);
    
              button.setOnAction(new EventHandler<ActionEvent>() {
                   @Override
                   public void handle(ActionEvent arg0) {
                        colorpicker.setValue(Color.YELLOW);
                        System.out.println("Set color of the picker to yellow.");
                   }
              });
    
              vbox.getChildren().add(colorpicker);
              vbox.getChildren().add(button);
    
              StackPane root = new StackPane();
    
              root.getChildren().add(vbox);
              stage.setTitle("ColorPicker");
              Scene scene = new Scene(root, 200, 200);
    
              stage.setScene(scene);
              stage.show();
    
         }
    }
    Published by: 963445 on January 3, 2013 12:23

    Addition of

    colorpicker.fireEvent(new ActionEvent());
    

    After you set the color seems to be a workaround; Although I don't know how it works if the colorpicker popup is displayed.

  • Change the value of "int" one within the arraylist class instance.

    It's my program...

    -Hello.java

    public class Hello {}

    public int a = 5;
    public char c = 'A ';
    }

    -Main.java-

    public class Main {}

    ArrayList < Hello > Hello = new ArrayList < Hello > ();
    Hello.Add (new Hello());

    Public Shared Sub main (String [] args) {}
    int b;
    int c;
    I'm going to get the value of "int a" in the first list of tables and store it in "int b.
    b = hello.get (0) .a;

    Now, I want to change the value of "int a" within the first class of the table
    ///////////////////////////////
    WHAT SHOULD I DO...? //
    //////////////////////////////

    Finally, I'll get the value of "int a" and store it in "int c".
    c = hello.get (0) .a;


    }

    }

    Help, please... >! @! @~

    Well, nothing of this code will compile, but if you corrected the errors, and that was the case, you can replace it with

    hello.get(0).a = 123;
    

    But what you should really do is read all the tutorials you can find.

  • PROBLEM changing the value of a variable in my scene movieclip

    Hello
    I have a problem changing the value of a variable in my scene movieclip. I explain: I combobox on my stage containing the categories, and in the scene that I load an xml file containing links to php files that work with the combobox control.
    On the stage I have a movieclip "camera roll" inside this movieclip on the first image I have a php script file selected in the scene of loading. I use a function with a variable load() "theUrl" inside like this: T.load (theUrl);
    In my scene, I want to change the value of "theUrl" within the film of movieClip. I tried filmstrip.theUrl = url; But it does not work

    the xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <slideshow>
    <area title1="10 Last updated" link1="link1.php"/>
    <area title1="special" link1="link2.php"/>
    </slideshow>

    Here is the code on my stage:

    var link1:Array = new Array();
    var LINK:String;
    var url:String;
    var whoOn:Number;
    whoOn=0;
    var x:XML = new XML();
    x.ignoreWhite = true;
    x.onLoad = function(success) {
    var photos:Array = this.firstChild.childNodes;
    for (i=0; i<photos.length; i++) {
    _root.link1.push(photos[i].attributes.link1);
    }
    url=link1[whoOn];
    filmstrip.theUrl=url;//<<--HERE
    };
    x.load("category.xml");
    
    var cbListener:Object = new Object();
    cbListener.change = function(event_obj:Object) {
    trace(select.selectedItem.label);
    if (select.selectedItem.label == "Last updated") {
    whoOn=0;
    } else if (select.selectedItem.label == "Special") {
    whoOn=1;
    }
    url=link1[whoOn];
    filmstrip.theUrl=url; //<<-----HERE   
    };
    select.addEventListener("change",cbListener);
    
    

    Here is the code inside the clip "film".

    var T:XML = new XML();
    T.ignoreWhite = true;
    T.onLoad = function(xml) { 
    etc etc etc }
    
    T.load(theUrl);    //<<---HERE it still undefined

    the code on the timeline of the film should be placed in a function() (or better, move all your code to the main timeline).  but, if you leave the code on the timeline of the film strip, call the function that contains this code whenever the url changes.

Maybe you are looking for