Replace the string value of table

with cte as)

Select val '123', 'abwec' double val1

Union of all the

Select "456" val, "mowerw" double val1

Union of all the

Select val '709', 'wkwere' double val1

Union of all the

Select val '078', 'awerwewerwreq' double val1

)

Select * from cte;

-incoming string

"asdasd123ewrwer@87w8eopiu456werwer@asdwer709@ewrwerewrwqqwezxder078 @..."

need to replace like 'abwec' 123 and 456 as "mowerw" and 709 as wkwere and 078 as 'awerwewerwreq '.

How to replace the string value of the string

I'm going to the table which will have mapping information I need to see the incoming string and replace the appropriate value of the val to val1

something like

Of

"asdasd123456werwer@asdwer709@ewrwerewrwqqwezxder078ewrwer@87w8eopiu @..."

TO

"asdasdabwecewrwer@87w8eopiumowerwwerwer@asdwerwkwere@ewrwerewrwqqwezxderawerwewerwreq@..."

By using the TYPE clause.

with cte as

(

Select val '123', 'abwec' double val1

Union of all the

Select "456" val, "mowerw" double val1

Union of all the

Select val '709', 'wkwere' double val1

Union of all the

Select val '078', 'awerwewerwreq' double val1

),

input_tbl

as

(

Select "asdasd123ewrwer@87w8eopiu456werwer@asdwer709@ewrwerewrwqqwezxder078 @..." input_str

of the double

)

Select max (input_str) Dungeon (first order by desc NWR dense_rank) input_str

de)

Select rno, input_str

de)

Select rownum NWR

val

val1

input_str

count (*) over() cnt

from cte

Cross

Join input_tbl

)

model

dimension (NWR)

measures (val, val1, cnt, CAST (input_str AS VARCHAR2 (4000)) input_str)

(

input_str [any] = replace (nvl (input_str [cv () - 1], input_str [cv ()]), val [cv ()], val1 [cv ()])

)

)

Tags: Database

Similar Questions

  • Search and replace the string formatting

    Hello

    I try to do a search and replace the formatting of a string.

    In the example, I'm looking for the string 'SUCCESSFUL', but it must also begin by usbflash and some number + PASSED.

    I can't get the format to have a number between 1 and 99. The number of replacements should add up to 6 in this case. I tried with \d for any number, and I also tried [1-99].

    Make a right-click on the function search and replace the string.  There is an option to use regular Expressions.  Then give it a try.

    EDIT: You need to set the entry replace all to TRUE.

  • How to replace the string "\" on json webservice?

    Hello

    I have problem with this json

    "{\"search_result\":[{\"name\":\"Mall Summarecon\",\"category\":\"BusinessEntity\",\"id\":\"1\"},{\"name\":\"Bamboo Dim Sum\",\"category\":\"BusinessEntity\",\"id\":\"2\"},{\"name\":\"Dimsum Ceker\",\"category\":\"Item\",\"id\":\"1\"}]}"
    

    I want to replace the string "\".

    the json are already working on my app via .cpp file

    I already add json.replace on my qml

    function simpleSearch(response){
            indicator.stop()
            model.clear()
            console.log("Response: "+response)
            var json = JSON.parse(response)
            json = json.replace('\\', ' ') // this is how the way i replace
            if (json == "[]")
                notFound.visible = true
    
            else
                model.append(json.search_result)
        }
    

    but still does not work

    is there a different way to replace it?

    Thank you

    Change your simpleSearchFinished as follows

    ....simpleSearchFinished()
    {
        QNetworkReply *reply = qobject_cast(sender());
        if (!reply->error()){
            QByteArray response = reply->readAll();
            response.replace("\\", "");
            if (response.startsWith("\"")){
                response.remove(0, 1);
            }
            if (response.endsWith("\"")){
                response.remove(response.length()-1, 1);
            }
            emit simpleSearchDone(response);
        }else{
            const int httpCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
            qDebug() << "ErrorCode" << httpCode << endl << \
                    "ErrorString" << reply->errorString();
            emit error(httpCode, reply->errorString());
        }
        reply->deleteLater();
        manager->deleteLater();
    }
    

    and QML

    function simpleSearch(response){
        indicator.stop()
        model.clear()
        var json = JSON.parse(response)
        if (json){ // is VALID/PARSED
            model.append(json.search_result)
        }
    }
    

    As I wrote, it is not a good workaround solution. The best is to send VALID JSON string directly from your server. But it works

  • 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.


  • Replace the NULL value with some characters

    Hi all

    I am writing a query to get the name of the contact and the age of a table. the age column has some value, I want these nulls to be replaced by "N/a".
    I user NVL ("age," n/a ")

    but it gives an error
    ORA-01722: invalid number

    Please suggest.

    Thank you

    Hello

    You must convert the age in tank to be replaced by the string of characters in the case opposite number

    Then use this

    select name, nvl(to_char(age),'N/A') from myage;
    

    Concerning

  • Replace the text values

    Hello.

    I have problem with replacement of values in text strings and I can't find a solution.

    I have two or three channels filled with only 2 values: OK and NOK. How can I replace these values with for example 1 for OK and 0 for NOK?

    This replacement is necessary for drawing a chart. I can't draw the chart because the tiara do not accept the values of text like a ladder with the current values.

    Thanks in advance :-)

    Hello Domin,

    replaces a substring in a text with another text can be done with VBS 'Replace' function

    The execution of a function on an entire channel can be made using ChnCalculate.

    Combine the two and you get:

    ("ChnCalculate ("ch ()"" statistics text"" "") = Replace (ch ("' statistics text" "" '), '' value' ', "" LLL"") ")

    It is a channel in the DIAdem example data set. The above command executes the command "Replace" for each value of the text string "text of statistics". He replaces each occurrence of 'value' by 'LLL '.

    Hope this helps

    Andreas

  • How to compare the 3 values in table

    Hi all

    This is my first post so be tolerant

    I need to find "bad values" in the table, it will be easier to explain with example:

    I have a table like this: 0 0 0 0 0 0 0 0 5 0 0 0 0<- so="" "5"="" is="" the="" bad="" value,="" my="" method="" is="" to="" check="" two="" of="" nearby="" values="" so="" x(i-1)="0," x(i)="5" x(i+1)="0," and="" if="" checked="" value="" is="" more="" than="" 25%="" bigger="" or="" smaller="" it="" should="" be="" replaced="" by="" average="" of="">

    example: 0 1 2 3 4 9 6 7 8<- bad="" value="" is="" 9,="" and="" result="" of="" my="" filter="" should="" be="" (4+6)/2="">

    I did it using the formula node (not 20% and no way, but the point is the same) and it works but now I want to do without C and I had a lot of problems because of the size of the array memory is 10000.

    I joined thah vi and signal, you can test that it works very well

    Thank you

    Mike

    MeeHow wrote:

    ... What is the problem?

    Because the first incorrect value is the point of 2780, because it is also disabled because the average of neighbour is biased by the incorrect value to 2781.

    You could jut blindly replace all values with the value that has the lowest absolute value among the three points that we have. Here's a quick project, seems pretty good, but it really depends what you want.

  • get the index of the same values in table

    Hi guys,.

    I'm trying to get the index of array elements with the same value but it can solve mine.

    my case is:


    array1 = [1,2,3,4]; <-here are the names of the pages, always in the order of CSA (these table I used only to check the results of my work, probably will not be for you but maybe...)

    array2 = [1,1,2,2,2,3,4,4,4]; <-these numbers are random, but always in the CSA order (these are the names of pages for items in table 3)

    array3 = [a, b, g, i, f, e, c, h, d]; <-these are all the values of the elements I want to work with later. number of articles is still the same as in array2, their indexes are corresponding.

    array4 = [];

    I need to remove array3 everything, but one of each issue of array2 (as I will remove duplicates) or push to array4 an article of array3 for each number of the array array2 (as I'm going to ignore duplicates)

    don't know is my desc is clear enough, but the result I get is:

    ex. [a, g, e, c]

    above example for each number of array2 array3 items, but do not have to be first, can be second or third if etc exist, but have to be alone.

    I thought that if I get duplicate values, the index in the array array2 and delete this index in array3 will get what I want, but can not solve.

    You will appreciate all help.

    Thank you

    Try something like this:

    var array2 = [1,1,2,2,2,3,4,4,4];
    var array3 = ["a","b","g","i","f","e","c","h","d"];
    
    var tempArray = [];
    var resultArray = [];
    var n , x ;
    
    for(var n=array2.length-1;n>=0;n--)
    {
        var string = ""+array2[n];
        tempArray[string] = array3[n];
    }
    
    for(x in tempArray)
    {
        resultArray.push(tempArray[x]);
    }
    
    resultArray.reverse();
    // a,g,e,c
    

    Hope, that helps.

    Uwe

  • Replace the string with the formatted text

    Hello all - I'm back to my beloved project...

    I want to replace a string by a TextSelction (formatted text) and began with the famous feature of Jang FindAndReplaceString.
    Since my replacement comes from another document (sourceDoc), I edited to targetDoc activeDoc and introduced a second document (sourceDoc).
    The replacePara actually comes from a stone where he had been placed to avoid switch backwards between the documents in a book (where to find and replace) and source documents. In another function, I learned that information on the table requires the sourceDoc must remain open.

    • Of course, everything works fine until I want to insert the replacelement:
      erase line 26 is the string
    • Given that I do not insert a string, I skip lines 28 and 29 and try try line 30
    • On line 30 DocumentSource is Document object and replacePare object TextSelection. However, sourceDoc.replacePara is not set and
    • (as a result?) line 31 past the current contents of the Clipboard.

    Of course, there is a fog around me... and I need some sunshine.

    function FindAndReplacePara (targetDoc, findString, sourceDoc, replacePara, loopMax) {
      var tr = new TextRange();
      var restoreTR, frame = 0, loopCounter = 0, replacementCounter = 0;
      var findParams = new PropVals();
      var firstPgf = targetDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
      
      tr.beg.obj = tr.end.obj = firstPgf;             //  set up the starting text range as the very beginning
      tr.beg.offset = tr.end.offset = 0;              // of the flow. We'll move straight from beginning to end.
      trSaved = tr                                    // to come back after work
    
      findParams = AllocatePropVals(2);
      
      findParams[0].propIdent.num = Constants.FS_FindText;
      findParams[0].propVal.valType = Constants.FT_String;
      findParams[0].propVal.sval = findString;
      
      findParams[1].propIdent.num = Constants.FS_FindCustomizationFlags;
      findParams[1].propVal.valType = Constants.FT_Integer;
      findParams[1].propVal.ival = Constants.FF_FIND_CONSIDER_CASE;
    
      FA_errno = Constants.FE_Success;                // errno global, to be used to track the progress of the find and replace
      tr = targetDoc.Find(tr.beg, findParams);        // and do an initial find to get started.
      
      while(FA_errno === Constants.FE_Success && loopCounter++ < 2*loopMax) { //find and replace loop as long as we keep finding
        targetDoc.TextSelection = tr;                 // set up the text range to clear the original text
        targetDoc.Clear(0);                           // clear it
        
    //    targetDoc.AddText(tr.beg, replacePara);       // insert the new text at the original beginning of the text range
    //    tr.beg.offset += replacePara.length;          //  lets jimmy the text range in memory to place it directly after
        targetDoc.TextSelection = sourceDoc.replacePara;        // paste the whole replacement paragraph
        targetDoc.Paste (0);                          // <-- Current contents of clipboard is pasted !!!!
        if(FA_errno === Constants.FE_Success) {       // increment our return counter
          replacementCounter++;
        }
        FA_errno = Constants.FE_Success;              // ...  find the next instance. We'll reset FA_errno again just in case
        tr = targetDoc.Find(tr.beg, findParams);      // something screwy happened while we were replacing text.
      }
      targetDoc.ScrollToText(trSaved);                // we're done. Restore the document to it's original area of display
      return replacementCounter;
    } // --- end FindAndReplacePara
    

    Hi Klaus,

    Thanks for the explanation. I remember something like that GetTabRange of the way back. You have been quite patient and persistent with this project, indeed.

    So, as we are dealing with ranges of text here, I think that the only simple approach is to perform a copy and paste. There is no way to save a 'formatted' in a variable. The only super precise way would be to get a data structure of each text range TextItems in the sourceDoc, then meticulously recreate every element of the targetDoc. It would be very complicated, I think, so copy and paste seems the most logical. I wonder, though, if Miss me something, because I think that maybe you would have tried already so yes (?)

    In any case, I would do something like that, from line 30 of your original code sample (code untested here):

    App. ActiveDoc = sourceDoc;

    sourceDoc.TextSelection = replacePara;

    sourceDoc.Copy (0);

    App. ActiveDoc = targetDoc;

    targetDoc.Paste (0);

    ... etc.

    Does make sense, or am I barking the wrong tree, as they say?

    Russ

  • Replace the text of another table

    I have 2 tables and table_a table_b

    Table_a has names in there while table_b has prefixes in there.

    create table table_a (name varchar2 (4000));

    insert into values table_a ("pepsi co ltd");

    insert into values table_a ('abc limited');

    insert into values table_a ("def corp");

    Insert the table_a values ('xyz');

    create table table_b (suffix varchar2 (4000));

    insert into table_b values ("co ltd");

    Insert into values table_b ('limited');

    Insert into values table_b ('corp');

    My reqirement, it's that I need to select then part of suffixes removed names

    Table so a willingness to return.

    "pepsi."

    'abc '.

    "def".

    "xyz".

    There is no condition of 2-table join.

    I tried something like that, but it gave me a error "subquery returned more than single-line a line."

    SELECT NAME, REPLACE (B.SID,

    (SELECT FROM table_b suffix, table_a WHERE NAME LIKE '%' | suffix |) » %' ),'') A

    FROM table_a A

    select A.name, replace( A.name, B.suffix, '') short_name
    from table_a A
      left outer join table_b B
        on (A.name like '%' || B.suffix);
    

    Make sure you save this short_name somewhere if you do not have to re - process data.

    MK

  • Replace the existing values in the BSO

    I use a rule of load to load the data from a SQL table. The SQL table has multiple records with the same combination of dimension.

    For example, if I have:

    Sheet 1: East soda sales 10
    Sheet 2: East soda sales 10

    When I use "replace existing values", and I question the intersection, I get 10. When I use Add to the existing values, assuming that it was nothing first, I get 20.

    I know Aso, you can use the buffer load to records of amount with the same intersection in the cube before loading to the database. My question is, should I use a SQL sum in the State of charge (since I can't create a view that aggregates), or is there some other facility in environmental assessments which allows to replace what is in the cube, but not replacement when the intersection itself appears twice in the same load of data.

    Thanks for your time.

    Published by: user12268822 on November 29, 2012 12:28

    If you want to replace what you have in the BSO cube with the sum of the values of the SQL, then you will need to use the money in your SQL query.

  • Search and replace the string in a column

    Hello

    In the table the data stored with "" (double quotes), I need to remove these quotes please suggest me how to remove


    Select the address of TECH_SOURCING_EMPLOYEE_DETAILS

    "No. 12/32"-> data recorded in this format in the table. I need to remove the double quotes


    Thank you
    Sudhir

    Hello

    UPDATE to modify existing rows in a table
    REPLACE to delete a given sub - a to a string.

    UPDATE     tech_sourcing_employee_details
    SET     address     = REPLACE (address, '"')
    WHERE     INSTR (address, '"')         > 0          -- Maybe
    ;
    

    This will remove all the quotes of the address.
    If you want to remove the quotes only from the beginning and the end of the string, then use TRIM instead of REPLACE:

    UPDATE     tech_sourcing_employee_details
    SET     address     = TRIM ('"' FROM address)
    WHERE     INSTR (address, '"')         > 0          -- Maybe
    ;
    

    The WHERE clause is only for effectiveness.
    So, whenever the column contains quotes, of the double quotation mark is always the first character in the string, then you can change the WHERE clause to:

    WHERE     address  LIKE '"%'
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    
  • sqlldr - replace "NULL" string value NULL?

    I have a file that I'm loading in the CSV format. An example of a record is something like this:

    ID, FirstName, MiddleName LastName,
    1, R, DOE
    2, NULL, such
    3, Jim, F, Doe

    My problem lies in the 2nd record. The real "NULL" text inserted in the field middlename. I know that I can use this in my control file to replace it with a real null...


    MIDDLENAME "REPLACE(:MIDDLENAME,'',)."



    However, I can't use as the string "null" could exist somewhere else (if the someone last name was something like "SNULLING"... bad example, I know).
    Is it possible in the control file to use an IF statement to determine if the field is only 'NULL '? I'm going to have no chance and would appreciate any help... (I use 11g R2)

    Published by: user9036239 on Sep 9, 2010 09:18

    Hello BoredBillJ.
    You can try

     , middlename  "CASE  :middlename  WHEN  'NULL'  THEN  NULL  ELSE  :middlename  END"
    

    or

     , middlename  "DECODE(:middlename, 'NULL', NULL, :middlename)"
    

    Hope this helps,
    Luke

    Please check the answer as helpful or response, if it is so. If this is not the case, further clarification.
    Try to always provide create table and table insert to help members of the forum to help you.

  • Take the minimum value for table data

    I'm storing test data in a table, with the hope that I can output the minimum value of the data. So far, I have used the table of max/min but can't make it work how I want. The test runs continuously in a loop of the holder. I get the minimum values in the table, but I would like to change the number of samples that the table contains, before it generates a minimum. The other option is that I run the test for a period of time (e.g. 3 seconds) and the table stores the data for this time then output 1 minimum value for the entire period.

    My current configuration VI is attached.

    Very appreciated

    Chris

    The size of the array in your VI is determined by the number of samples that you collect in your DAQ assistant, who is now 100 samples.  Never more, never less.

    How many samples do you want before you determine the minimum?

    Maybe what you really want to do is to build the table in the while loop and store it in a shift register, and when the loop has repeated enough times, then you take the minimum of built table.

  • find the closest value in table

    Hi all

    I need to find the values in the "C" line which is equal or close to the values 'A' in the 2D array, and then I want to show the values of 'B', corresponding to the values of 'C' in table 2D.

    How can I fix it?

    Thank you!

    0.9967 nearest value is 0.993807 in the 8 Cand in row B row, not 1. The differences are 2.893E - 3 and 3.300E - 3.

    Subtract each value from the table C. take the absolute value of the difference. To find the index of at least using Max & Min value of B. Using autoindexing array Index, create the output array.

    Lynn

Maybe you are looking for