columns of traverse

Hi guys,.

Oracle version: 11g

I have a requirement where I need browse table one for columns a and b and I need to update the sequence.

but not having no idea how to do to browse a and b update the sequence column give an idea

Data table

a c b seq

1 2 a 1

4-5 v 3

5 6 d 4

7 8 k 5

8 9 6 o

3 4P2

Concerning

Hello

user123 wrote:
HI Frank,.

Thank you very much for the reply.

The column must be exchanged if we find the value ex: polk in the same column as b in this case.

A          B          C                 SEQ
---------- ---------- ---------- ----------
lkih       polk       j                   4
*polk      oliu*      r                   5
oliu       tygr       q                   6
tygr       lkhy       k                   7
lkhy       ooyi       o                   8

When you find what value in the same column? Compared to what line? In the unswapped results, rows with seq = 4, 5 and 6 were all either has or identical to a neighbor of line b.
If you the results as only after the first row, one is identical to b on the previous (in order of seq) line, then I think you need to keep track of how many times CONNECT BY relied on a match column and toggle whether a and b are exchanged at each time a connection is made :

MERGE INTO abc          dst
USING (
          SELECT  a, b
             ,       MOD ( SUM ( CASE
                                  WHEN  a = PRIOR a
                        OR    b = PRIOR b
                        THEN  1
                        ELSE  0
                                 END
                   ) OVER (ORDER BY  LEVEL)
                , 2
                )          AS switch
       ,      LEVEL          AS seq
       ,      ROWID          AS rid
       FROM    abc
       START WITH       a          = 'abcd'
       CONNECT BY NOCYCLE  PRIOR a     IN (a, b)
                   OR            PRIOR b      IN (a, b)
      )               src
ON    (    dst.ROWID  = src.rid
      )
WHEN MATCHED THEN UPDATE
SET   dst.a   = CASE WHEN src.switch = 1 THEN src.b ELSE src.a END
,     dst.b   = CASE WHEN src.switch = 1 THEN src.a ELSE src.b END
,     dst.seq = src.seq
;

You have Oracle 11, so it should work. If anyone using an earlier version reads this, be warned that combining the analytical functions (such as SUM, above) and CONNECT BY in the same query often causes CONNECT BY give erroneous results. Once again, this problem seems to be fixed in Oracle 11.

Jac says:

MERGE INTO abc             dst
USING (
SELECT  rowid rid,a, b,
LEVEL         AS seq,
row_number() over(partition by a order by null) r1,
row_number() over(partition by b order by null) r2
...

ORDER OF NULL reorganized lines arbitrarily. If it produces good results, it was purely by chance.

Tags: Database

Similar Questions

  • In table form, a dynamic action to disable and set of columns of text

    Hello!!

    With the help of APEX 4.2.6 with Oracle 11 g R2, someone I work with has a tabular presentation of the need to do the following:

    Tables has the following provision:

    When the user selects the UOM LOV Dollars, the rate must have related associated text box the amount set to 1.  We currently have JavaScript disable and set the background color, but fo rth elife of me that I can seem to help set the value...

    The code we have in dynamic action:

    < tt >

    ROW_ID = $(this.triggeringElement).attr('id').substr (4);

    If (. val() $(this.triggeringElement) == 2)

    {

    $(«#f04_» + row_id) prop ('readOnly', 'readonly');

    $(«#f04_» + row_id) prop ("class", "textinputdisabled");

    .Val (1) $("#f04_" + row_id);  < = Here's where we had the question...

    }

    on the other

    {

    $(«#f04_» + row_id) prop ("readOnly", false);

    $(«#f04_» + row_id) prop ("class", false);

    < /tt >

    Thank you

    Tony Miller
    Los Alamos, NM

    Hi Tony

    What exactly is the problem here? I have no problem setting the value using the method described above. There is even a '1' in the screenshot above, no doubt, which indicates that the value has been successfully changed.

    For ease of improved management, I'd use traversal Dynamics for the form element affected, rather than hard-code the ID (or go with a DA conditional with distinct actions of true/false), but the jQuery code to set the value is the same:

    var uom, rate;
    
    uom = $(this.triggeringElement);
    rate = uom.closest('tr').find('td[headers="RATE"] input');
    
    if (uom.val() === "USD") {
      rate
        .prop("readOnly", true)
        .addClass("textinputdisabled")
        .val("1");
    }
    else {
      rate
        .prop("readOnly", false)
        .removeClass("textinputdisabled");
    }
    

    (I used a static LOV in the column of the unit of MEASURE, so the value of '$' is 'USD' rather than '2').

  • Number of matches between two columns

    Column1 Column2
    5 5
    5 2
    5 5
    4 3
    4 4
    Football match
    3

    I basically you want to compare two columns and count matches in the corresponding lines. I tried using the following formula:

    SUMPRODUCT (--($column1=$column2))

    ... but it doesn't work! Any suggestion?

    Tiago,

    It seems you are trying to use array formulas (maybe since excel?) who do not work in number.

    Here's how I would solve this problem:

    Make sure that the table where data is named 'Data' (as shown, or change the table name references to match your table name)

    Add a new column (C)

    C2 = AND (A2 = B2, A2≠ "")

    It's shorthand dethrone select cell C2, then type (or copy and paste it here) the formula:

    = AND(A2=B2, A2≠"")

    Select cell C2, copy

    Select cells C2 at the end of the C column, paste

    the formula say to check to see if the cell in column A is NOT empty, and is equal to the cel in column B

    Now in the summary table (single cell table):

    A1 = COUNTIF (Data::C, TRUE)

  • images don't "move with the text" correctly when I have several columns

    I use 2 columns, have been inserting images in my text and chose 'move with the text' but when I have to go back and fix something, or add text over the images all move and do not stay with the text.  They start on their knees and move to the other columns and will not stay with the text.  In my view, this has to do with the use of columns, does anyone have any suggestions?

    What version explicit pages (Pages: pages) and the Apple logo: about this Mac) operating system version are you using? There are different, a functional version of the Pages that are running on the current releases of OS X and guessing will not help you.

  • Need to limit the number of columns

    When a tab in the last cell of the row, I want the cursor to the next line down. Instead, it creates a new useless column. Can't seem to find a setting that allows me to limit the number of columns in a page - someone ' one knows how to do this?

    Thanks for your wisdom shared, Oh wise Ones.

    I'm not aware of do what you want.  You can post your comments directly to Apple using the menu item "numbers > provide Feedback numbers.

    You can still use the key combinations:

    < command > + < right arrow > to access at the end of a line

    < command > + < left arrow > to move to the beginning of a line

    < command > + < down > to pass at the end of a column

    < command > + < arrow > to move to the beginning of a column

  • Automate the cells of the filter to another table based on two columns

    Hello

    What I'm trying to do is: filter multiple cells to a new table. In this example, I want that all students (column 'lidnr', 'city', then the first 7 columns) with 1 teacher in the 'First' column to be copied into the table 'teacher 1'. The same goes for students per 1 teacher in the column "second". I know it can be done with the help of the filter and the copy paste, but I would like to know if this can be automated, because there are many more tables in my actual document.

    I've been using maybe to think the search formula but he can't give me more than one result, the result must be unique.

    Thank you very much for your help.

    Kind regards

    Kim

    Hi Kim,

    The usual way to do this is to add an index for each table for which column the data is to be copied.

    Here is an example of preliminary. Improvements after return from the light of day.

    Triangles of error on the last row of T1 are thanks to the formula out of data to search for. Easily fixed.

    Order of the names is different from your example, which is grouped by day numbers. Build lists in the desired order, rethinking the index calculations.

    Course index calculations use the formula below, entered in Table 1::L2 and thre to the rest of the blue full cells filled.

    L2: = IF (OR (RIGHT($H2,1) = RIGHT (L$ 1.1) RIGHT($J2,1) = RIGHT (L$ 1.1)), MAX(L$1:L1) + 1"," ")

    Data recovery on the Table T1 is well done by the following formula, entered in A2 and down and B2 and filled and down-filled.

    A2: = INDEX (array 1::A, CORRESPONDENCE (LINE (−1, 1 Table): $L, 0))

    B2: = INDEX (array 1::B, CORRESPONDENCE (LINE (−1, 1 Table): $L, 0))

    More tomorrow (actually, later today).

  • Column Salary to come in the form $ does not time?

    Trying to get this works, but can't. Help, please. You will need to get the column Salary to come in the form $ instead of the time. Whenever it is multiplied by 12, it ends by multiplying by time and not by $12. So I'll take 48 h 0 m instead of $48. There are some pictures of what I am trying to accomplish. There's a picture of what is happening and another pic of my formula before you enter the time in time and get the product duration under treatment. Help, please. Thank you

    E SALVATION '

    You multiply at a range of a number. The result is lasting. That makes sense, if you do 15 minutes (duration) of exercise every day for five days (number) you have made 1.25 hours (duration) of exercise.

    For a numeric result, you need to multiply a number (hours) by a number of $ / hour. Your friend here is DUR2HOURS, which converts a duration in a number representing the number of hours:

    Kind regards

    Barry

  • Column width of the mailbox in the Mail of Sierra application

    Hello everyone,

    After the upgrade to Sierra, everything went well, but a strange and annoying defect in the Mail application: I've enabled the display of three columns (mailboxes, the list of messages, the content of the Message). Well, the column of the mailbox does not keep its width, restore continuous width stretched, whenever I close the application window.

    If I expand the column to display the full name of my multiple email accounts, this preference is lost whenever I close the window. Strangely, if I exit the application without closing the window and then that I raise, the width is maintained, but it is ready to be reinstalled the next time I have everything simply close the window... is possible to make it permanent? The other two columns do not exhibit this problem and their width is however maintained, even if I close the window or quit the app...

    Thanks for your suggestion,

    Enrico

    Hi Enrico,.

    I understand that you are having problems with the column width of mailbox remaining the same size when you close the Mail application window. I use the Mail app all the time so I can understand your concern. We will be that we can do.

    Since this problem occurs in your main user account, please start the Mac in safe mode, connect as user principal and then add to your account e-mail and then test it. Once you have tested out, just restart your computer to find your main office.

    Try safe mode if your Mac does not end commissioning

    If the problem persists in safe mode, please test this point to a different user account. This will help determine if the problem is the system level or a specific user.

    How to test a question in another account on your Mac.

    Thank you for using communities Support from Apple. Have a great day.

  • Return all column names of the cells that match a value in a single cell

    I want to be able to scan all the cells in column 1 in column 3 (there could be several) which belong to the same line and check if they all have a value y (X). If they have no value, I want all columns to display all the names of the matching columns as follows: "column 1, column 2" for Elemento.

    This can be a good start:

    B2 = if (counta (C2) > 0, C$ 1, "" ") & IF (COUNTA (D2) > 0', ' & D$ 1," ") & IF (COUNTA (E2) > 0', ' & E$ 1," "") & IF (COUNTA (F2) > 0', '& F$ 1,' ')

    It's shorthand dethrone select cell C2, then type (or copy and paste it here) the formula:

    = IF (counta (C2) > 0, C$ 1, "" ") & IF (COUNTA (D2) > 0', ' & D$ 1," ") & IF (COUNTA (E2) > 0', ' & E$ 1," "") & IF (COUNTA (F2) > 0', '& F$ 1,' ')

    Select cell B2, copy

    Select the cells B2 the bottom of column D, dough

    To add additional columns, you copy the atomic unit:

    & IF (COUNTA (D2) > 0', '& D$ 1,' ')

    and update D2 with the new column and D$ 1 with the new column.

    then... If you add a new column (G, for example) that you want to change it:

    and IF (COUNTA (D2) > 0', '&D$1,' ')

    TO

    and IF (COUNTA (G2) > 0', "&G$1," ")

    and the updated formula would be:

    = IF (counta (C2) > 0, C$ 1, "" ") & IF (COUNTA (D2) > 0', ' & D$ 1," ") & IF (COUNTA (E2) > 0', ' & E$ 1," "") & IF (COUNTA (F2) > 0', ' & F$ 1,"") & IF (COUNTA (G2) > 0', '& G$ 1,' ')

    fill down like before

  • iBooks/iPad two columns per page

    Since this morning after an update to the iPad, iBooks is showing the book pages in two columns instead of a full page, from left to right.  How can I change this back to a page on the screen?

    I saw that too. Stupid solution. Increase your font a to the top of the smallest.

    The smaller police apparently goes into two columns.

  • macOS Sierra/iTunes 12.5.1 - where is the option to view 3-pane column?

    I just upgraded to macOS Sierra and iTunes 12.5.1.21. I'm trying to find where I can display my iTunes library in that 3-pane column see, but I can not find the option. It can be under the view menu in iTunes. Does anyone know where it was moved to?

    I have a library of 200 GB and more, with hundreds of albums under 20 kinds, so that column 3-pane view is view only option that really allows me to find and discover all my music quickly and easily. I hope that the display option has not been removed from iTunes in this new update, which would be catastrophic for me.

    Hello

    -What are you talking about?

    Jim

  • Use the 2nd column for the label data

    This should be easy. Online help for the numbers shows an example under Add graphics > adjust figure brands and labels.  My table is a simple 2-d column chart. In a single column, I have the weight in pounds, and in the second column, I have a date. When I have only the weight column selected in the form of data, I get a graph that is almost perfect, but there is no date label. When I try to include date data, I have a reverse relationship X and Y. Once I selected a cell as reference data, it doesn't have any way to deselect. What I want to do is chart weight against date and have the date appear as a label.

    Any advice is welcome.

    Hi innerserenity,

    I swapped the order of the columns. Column A is a column header.

    Kind regards

    Ian.

  • Find the percentage of double pairs false in five two sets of columns

    The situation is that I have four sets of two related columns, and these four sets are repeated during 17 sheets. They are all checkboxes (essentially and or or), and I've already configured to do a little when one of them is checked.

    What I want to understand, is if it is possible to indicate the percentage of a pair of two time column to be false. I want to compare, over time (represented by worksheets), how each pair of column.

    Here is a screenshot. Currently, I am tagging manually false lines double red, but I would like to than my 18 leaf, which collects information about the rest, to quickly view how each column pair done.

    You can count double false according to the following formula:

    = COUNTIFS (A, B, FALSE, FALSE)

    Showing maybe some of you could move it from whats on a sheet, view table names, and what is on page 18.

    This will allow us to provide a solution specific to your situation

  • Compare two columns and get the percentage of cells that match

    Hello

    I'm looking to take two columns of data from different tables in the same document, which should have a high enough percentage of boxes and have another cell tabulate the corresponding percentage. I can the of seem to figure out how to do this, but it seems really possible.

    Any help is greatly appreciated.

    Thank you!

    C1 = A1 = B1

    It's shorthand dethrone select cell C1 and type (or copy and paste it here) the formula:

    = A1 = B1

    Select cell C1, copy

    Select the column C, paste

    Select cell E2, and then type 'TRUE '.

    Select cell E3 and then type "FALSE".

    F2 = COUNTIF ($C, E2)

    F3 = COUNTIF ($C, E3)

    G2 = F2÷SUM(F$2:F$3)

    G3 = F3÷SUM(F$2:F$3)

  • Help formula: count the number of whites in a column "up to the...» »

    name string metric
    Matthew 5
    brand 1
    brand optimusPrime
    brand
    Luke 2
    Matthew jamesLikesSteak
    John 3
    Luke lukingGood
    Matthew
    Luke
    John johnnyPop
    John

    Hey guys - so I do business with a bit of a problem in number. I have a number table - the table above is a simplified representation of the corresponding parts of the table. The left column 'name' is a series of 12 names repeated and 0 missing values. The "string" middle column is a column that has a lot of missing values by a formula based on another column that is not relevant to this problem. Who is not missing is all strings. The problem I have is in the 'metric ': right column

    I am trying to create a dynamic formula which will result in the numbers and blanks, exactly as above. My goal is to create a formula that, for each line, account the number of whites in the column 'chain' until we reach an empty 'string' which occurs next to "namesake" as in the line of housing the formula - and if there is no such a situation, so that it is empty. For example, if the second row (including header row) bears the name of "Matthew". The next time that a white 'string' occurs next to the name "matthew" is tenth. The number of whites that occur between the second row, and the ninth is 5 (lines 2, 3, 5, 6 and 8). I manually coded a small part of the table to use something like this (which would be installed in cell C2 in this example):

    = IF (B2 = "", COUNTBLANK(B2:B9), "")

    This formula produces the correct number for the first row of data (5), but it does not dynamically fulfill what I'm trying to do this since I am currently having the formula to find the next blank 'chain' that occur next to "name" in the formula line.

    I hope that someone has encountered anything like this before. I tried to go through all the functions and numbers from formulas, but so far I have not found much success.

    Hi BaronDe,

    I need to ask, "why you try to do this? So what you want is possible it will be a complex solution. It may be much easier to get your information in a different way. Indicate these blanks?

    You should know that COUNTBLANK() will not count a cell with a formula, even if this formula resolves to «»

    Quinn

Maybe you are looking for

  • Check warranty status

    I bought the bike G4 more on Amazon and it registered on the Motorola site for records and information of warranty. When registering, I also downloaded my phone bill. However, after a month, I don't see any possibility to check the status of the warr

  • Digital and analog gain in Script mode

    Hello. 5422 module can change the voltage Vp-p order of 05:54 V. But when I use the property node - digital Gain, after setting the 1.1 V and return to its previous value (V 1.0) occurs the following error: And when generating a signal of amplitude o

  • HP LASERJET M1005: PROBLEM OF SCANNING WITH REGARD

    DEAR SIR. WE HAVE A PROBLEM OF SCAN THAT THE SCANNER DISPLAYS THE MESSAGE "ERROR 12 SCANNER". WE NEED A DAILY COPYING AND SCANNING. SO IF PLEASE LOOK AFTER THE AFFAIR AND URGENT.

  • How can I change my default e-mail settings?

    Im trying to reply to an email on craigslist and it said I need to change my default mail settings how can I do this?

  • Order by email

    How can I permanently change email to oldest first?