reorganize around defined positions

Hello

In my 11.2.0.3 oracle database, I have a table that contains a 'physical' order, which is maintained by the system.

for some entries, I have to recalculate a 'logic' based on the 'physicalorder' order, but without taking into account some of the entries in the table. No problem with that since the row_number function is one of my friends.

with my_data as (
  select 371 as PK,   2 as physical_index from dual union all
  select 381 as PK,   5 as physical_index from dual union all
  select 391 as PK,   9 as physical_index from dual union all
  select 401 as PK,   7 as physical_index from dual 
  )
SELECT md.*
     , ROW_NUMBER( ) OVER (ORDER BY physical_index) AS logical_index
  FROM my_data md;

"pk","physical_index","logical_index"
371,  2,        1,
381,  5,        2,
391,  7,        3,
401,  9,        4,

This table is about to get another field "landline", where the user can enter an index in which this article should be rather than what row_number() simple function gives

with my_data as (
  select 371 as PK,   2 as physical_index,    3 as fixed_index from dual union all
  select 381 as PK,   5 as physical_index,    null as fixed_index from dual union all
  select 391 as PK,   7 as physical_index,    null as fixed_index from dual union all
  select 401 as PK,   9 as physical_index,    2 as fixed_index from dual 
  )
SELECT md.*
     , null as logical_index -- what to write here?
  FROM my_data md;

should give

"pk","physical_index","fixed_index","logical_index"
371,   2,   3,   3,
381,   5,     ,   1,
391,   7,     ,   4,
401,   9,   2,   2,

is this possible with a single SQL?

Good bye

DPT

Just check my own solution...

Seems to work ok if there is more data and indexes 'fixed' are divided...

SQL > ed
A written file afiedt.buf

1 with my_data (pk, physical_index, fixed_index) as)
2. Select 000, 1, null of union double all the
3. Select 371, 2, 2 Union double all the
4. Select 381, 5, null of union double all the
5. Select 123, 8, null of union double all the
6. Select 391, 9, 4 Union double all the
7 if he would choose 401, 7, the double null
8    )
9  --
10 g, as (select the level from dual connect by level<= (select="" count(*)="" from="">
11. Select md.pk, md.physical_index, md.fixed_index
12, g.l
13 g join my_data md on (g.l = md.fixed_index)
14 union
15 select md.pk, md.physical_index, md.fixed_index
16, g.l
17 in (select row_number() over (order of l) r, l
18 g
19 when l not in (select nvl (fixed_index-1) to my_data)
(20) g
21 join
22 (select pk, physical_index, fixed_index, row_number() over (order by physical_index) r
23 of my_data
24 where the fixed_index is null
(25) md
26 we (md.r = g.r)
27 * order by l
SQL > /.

PK PHYSICAL_INDEX FIXED_INDEX L
---------- -------------- ----------- ----------
0              1                      1
371              2          2          2
381              5                      3
391              9          4          4
401              7                      5
123              8                      6

6 selected lines.

Tags: Database

Similar Questions

  • Position anywhere automatically updated

    Hi all

    Is anyone having problems with the auto key framing the position of a null value in CC2015.

    If I set the timer, it will be automatically updated only once, if I can go to the next section and move the position it does not add a keyframe. I can see the X position and change and if I click on add keyframe it add it ok.

    It works well for other processing options like the size...

    Any ideas?

    Thanks Dave

    HI guys,.

    Thanks for your answers, I found out where I was going wrong.

    I was striking and pass NULL in the upper left corner of the box from nowhere (a small black dot appears under the cursor and the cursor turns black), allowed me to move the position of the null value, but does not automatically update the keyframe. If I catch anywhere else inside the border, he made around its position and added a keyframe. I guess moving with the cursor black must be another function that I'm not aware of.

    Thank you for taking the time to answer for me.

    Dave

  • How to create a hot spot for a full browser image?

    I have a background image created in Photoshop in the browser padding, scale to fill.

    This is my landing page and would like to create an 'invisible' reactive or rectangle area to post a link to another page in my site when clicked.

    I did this and work, however, my problem is that when my browser size is expanded or reduced, the place where I want the area reactive to be changes in the size and location.

    I want to create a hotspot that will keep its form around my logo no matter the size of the screen.

    I tried this with a no bottom box and white outline to see how he responds to each fill property but may not know how to create a box to be in a fixed position that will always upward

    with the browser fill image location and size.

    Thanks for your help.

    Hello

    Have you tried to pin the box on the page so that it should be in a fixed position?

    Also if you want the box to be on a specific job with scrolling the page, then you can try using the scrolling of the effects that would scroll the page box but inside the defined positions.

    Thank you

    Sanjit

  • Mode of double chassis with a C8484 of Hamamatsu-05 and a PCI-1426

    Hello

    I use a hamamatsu camera CCD C8484-05 (http://sales.hamamatsu.com/en/products/system-division/machine-vision/part-c8484-05.php), with a PCI-1426.

    Despite the site NOR say they are compatible, Hamamatsu, tell me that the camera is compatible only with the 1426 to use drivers OR and not the vi Hamamatsu. (http://sales.hamamatsu.com/index.php?id=13200492&language=1&)

    I find the file .icd for C8484-05 on the Web site of NOR, and using IMAQ, I can control most of the settings using the camera fixed attribute vi.

    However, it doesn't seem to be an option to set the mode of double exposure for PIV (i.e. 2 exposure Framework 2 by using double buffering)

    I have to do it manually by using the low-level buffer commands? For a previous camera (IDT X 3), I was able to select this option in their provided VI.

    If so, could you point me in the direction of some good tutorials for using tampons?

    In addition, there is an easy way to get all the options without copying the text in each menu MAX and using several structures of matter?

    Kind regards

    Joe Sherwood

    Find attached the modified version of the. CIM file for this device (C8484 - 05 c). I saved as a txt to allow download the Forum of nor. Simply change .txt to .icd and place in > National Instruments\NI-IMAQ\Data

    This allows dual-mode frame/PIV using "quick repeat mode also affecting all standard features. The polarity of command is defined positive and the first exhibition is 4.5us, while the second is 81.7ms (without binning)

    I hope it's useful.

    Concerning

    Joe

  • custom control represent switch

    I'm trying to represent a switch in LabVIEW using a dial. However, I can't understand how to customize my control to watch as I want. I would like him to have options as below

    /

    _

    \

    So I inverted the numbers on my dial so the needle goes counterclockwise. Then I got rid of all the "decorations", so apparently not 3d, flat. But, if I put the maximum of 3 he puts the three around the position of o'lock 7 by default. I want essentially the three to the 01:00 position. So, my next step was to do the maximum, go up to 10 and hide the numbers past three. But, if I do this, the user still has the ability to adjust the past 3. How to make this work?

    Thank you.

    Apparently I need two characters to be displayed.

  • How can I get a screen with only nested handlers for scrolling?

    I have a single screen with only nested boxes that does not scroll. No fields or buttons, just displaying data.

    The funny thing is, the screen does not scroll at all.

    I tried a combination of:

    super(Manager.VERTICAL_SCROLLBAR | Manager.VERTICAL_SCROLL
                    | Manager.NO_HORIZONTAL_SCROLLBAR
                    | Manager.NO_HORIZONTAL_SCROLL);
    

    Any thoughts on why the screen is not Ahmed with only the data displayed?

    The screen does not scroll because he has no reason to scroll. BlackBerry auto-parchemins the field to receive the focus (or, more specifically, the focus of the field - field text rectangle has this rectangle around their position of slider, for example). There is no other mechanism of scrolling integrated for non touchscreen devices.

    If you have no Focus field, you can scroll through your Manager / screen programmatically with setHorizontalScroll() / setVerticalScroll(). Decide in what way is more acceptable to you.

    If you want to display some text (help screen?), put it in one (descendant of) TextField, FOCUSABLE and READONLY and let the user navigate through the text with the cursor. Remember - even if you can't change RichTextField, you can make it active and allow the user it work very well.

    Good luck!

  • First time with 802.11n, works does not correctly?

    Hello

    It's the first time I use 802.11n in my network there is an AP1141 but customers don't connect to 802.11n rates, instead, they connect to as low as 11 Mbit/s rates. At first, they connect to 144 Mbps but immediately it decreases to 11 or 12.

    Many of our clients wireless in the enterprise are Intel(r) WiFi Link 5100 AGN.

    Any comments?

    AIR-AP1141N-A-K9

    AIR-WLC2106-K9

    6.0.182.0

    Let me know if need more information?

    Thank you

    Correct, you do not want to bind to 2.4 GHz because there is not enough bandwidth for channel assignments appropriate. I didn't know it was a small deployment and with mixed aps. The client may simply be traveling between access points. I would like to do this, take your 802.11n client, plan floor in hand and go to define positions and mark down of your dB of signal and the PHY perforamnce rate.  Customers manage roaming. If they see a stronger signal to another access point that is part of your ESS they will choose to move to this another AP.

    It may be a case where the customer makes 802.11n AP to 1131 g AP.

    Regarding the WPA2/AES. Yes, if your clients support WPA2/AES. I want to disbale WPA/TKIP. No need for additional data in the tags. I saw in some cases this cause problems of customer...

  • VCenter deployment issues 6 - domain SSO

    Hello

    I have a problem my head around defining the domain of SINGLE sign-on in my new vSphere deployment package 6.0. I have a domain active directory (server.local) and installing vCenter 6, you are prompted for the SSO domain name (default is vsphere.local). What I want to know, it is important that name and what is the impact of the choice or change default name? The reason for my question is the following:

    1. we have a vSphere/vCenter 5.5 for our domain infrastructure deployment and the application that uses vsphere.local as the domain of SINGLE sign-on.

    2. I am deploying a new environment 6.0 vSphere/vcenter for a new VDI environment.

    3. I will deploy a second 6.0 environment vSphere/vCenter for a second VDI environment.

    4. I will use more connected between two vCenter environment 6 because I want to keep totally separate.

    In factoring, is it safe to use vsphere.local for my first 6.0 deployment even if I use vsphere.local for my production environment 5.5 already? If it is OK, then is it OK to use vsphere.local for both of my 6.0 vSphere deployments, even if all three environments will be authenticating against the domain active directory domain.local? The domain authentication UNIQUE write anything to AD or just authenticates against it so that I can use the same SSO domain in three distinct environments without negative impact?

    Any help with sort my confusion with this would be greatly appreciated.

    Thank you!

    Yes, it is safe to use the same domain name SSO for multiple deployments of vSphere, even if you use the same Active Directory domain as a source of identity. Don't forget that before vCenter 6, you are not able to change the domain name from SSO for anything other than the vsphere.local and this has never been a limit to how many vCenter Server can be deployed and configured to use the same Active Directory domain.

  • My "move" tool does not work as usual.

    My move tool does not work as usual.

    After pasting an image into a new model, it is impossible to move around, to position the image on a desirable location. The photo is back in the middle of the model as soon as I leave the mouse.

    This is a silly question, I know... I'm sure that some button is locked or not well placed, but I can't find the solution.

    It would be great if someone could give me a clue...

    Thanks in advance,

    Bottom

  • Problem with the smart shape in reactivity text captions

    I have slides with many text captions, which are all intelligent forms with text inside them. Tips on how can I prevent the text to be cut in small breakpoints would be greatly appreciated.

    I tried different settings but nothing works well. I prefer not to manually edit and resize text captions to each breakpoint.

    You have configured by the styles for forms in the management Style of the object to change the font size in each breakpoint? Regarding the size of the form how do you define Position Panel for these forms? Do not be naïve, Jay, a sensitive project needs much more time to create. You will have to edit three situations instead of one, but the right settings can save time. I know that marketing is an another story

  • Can I create an image of several words?

    For example, I want to place an image in the words "Applesauce is very healthy." I "created the contours" and placed the chart, but it became only the first word.

    Any help would be appreciated.

    Good, depending on how you got to where you are, it is possible that each line or Word (of the underlined text) is now in a frame which is embedded inside a block of text. Try this:

    Deselect everything.

    Click on the first word or line.

    Choose Edition > cut

    Choose Edition > paste

    This will release the frame grounded, sticking outside the text frame.

    Repeat for each image that remains anchored in the he text block.

    Now, you will probably have to reorganize your words position them as you wish (and delete the now empty text block where they were anchored).

    Select all of them.

    Now oppose > paths > make compound path must be available.

  • Grep search for ordinal numbers

    ID CS4

    OS 10.6.8

    (? < = \d) [\l\u]+\ >]

    That's my word. It works fine except that it will only find one ordinal number. I tried different options with a + in and around the positive look behind, but nothing seems to work.

    I'm working in a bilingual environment, and I would have preferred an expression that does not include all possible letter combination.

    Any thoughts?

    OK, the last answer was the expression of Eugene with {0}.

    You cannot use an expression of variable length in a postanalyse, but I think that------<> <=\d)[\l\u]+\>will do what you want.

  • How to keep content the same cross browser?

    Hello

    I put my site on the way I wanted it looks, and I was going to start adding content when I tested in several browsers and realized that it is not the same aspect. It seems Flory in IE, Mozilla and Chrome, but not in Safari. Also, I think that my biggest problem is that when you change your viewing window dimensions, the logo and the bar manu seem to "flow" or change with the change of deminsion, while the sidebar and the content remain static. I've been messing around with positioning and I tried to use absolute, but I don't think I use it properly.

    I would like to be able to 'restore down' or unmaximize my browser and have all my content, change of position on me when I do.

    Site: www.thecampuscocktail.com

    Thanks in advance,

    DW_Noobie

    Delete

    http://www.thecampuscocktail.com/twoColFixLtHdr.CSS"rel ="stylesheet"type =" text/css"/ >

    Add to the head, just above #logo section

    {body

    Width: 980px;

    margin: auto;

    Police: 100% / 1.4 Verdana, Arial, Helvetica, without serif.

    background-color: # 42413.

    background-image: url(images/slate.jpg);

    }

    GRAMPS

  • Clips AVI being rescheduled when preview is rendered vertically

    I use the first Pro CS5, to complete a composition of triplhead2go 2400 * 600. I have set up the office, 2400 * 600 pixels square, 25 fps & previews to the same thing. All of the source clips are out of After Effects (800 * 600 pixels square, uncompressed avi) and I want to put three 4:3 side by side clips.

    It worked perfectly when I tested it in AE, but I'm wanting to change in first. I import the clips, defined positions (X = 400, 1200, and 2000) but as soon as I hit enter to display images, the vertical height is crushed to about a third of the size of the actual item. If I'm 101% scaling or any other clips, exactly the same problem of scaling happens when I go to the timeline.

    When I try to export to test whether the same thing happens, I can't put an output of more than 1920 resolution. I'm not sure what I did wrong! Clips definitely seem ok, it works in AE and they play at the correct Res to several players, so I can only assume something bad in my creation parameters. Is there a workaround or something I should change when you configure the project?

    Any help is greatly appreciated as I have reached a dead end.

    Thanks Stephen. It was an avi file uncompressed too however, so I'm not sure of what was the case!

    I finally managed to settle now - the problem is that my computer could not handle the previews to this resolution for a reason any. http://help.adobe.com/en_US/premierepro/cs/using/WS53d845b1b545aceaa625a7d1260ffe2746-8000 .html . When I cut in half to 1200 preview settings * 300, which was good and first could handle without scaling. Great relief!

  • Button controls with motion tweens

    I am wanting to create a button that, when pressed, will be an image move along the X axis.  I would, however, several other buttons to move this object on the x axis in other places no matter where it is currently.

    I want the object to move from one place to a second stop spot and then move to this new location to its previous place or a new spot.

    Basically to have several control buttons where 1 or more image will.  I saw banners that scroll horizontally when you click on the various Menu buttons.  The banner behind the scenes along the x-axis and stops to reveal the name of the new page on the banner (home, about us, contact us, etc.).  When another menu button, slide in banner to reveal the new name for the title page (IE. House, etc.).

    I'm coming from a designer point of view and not a very good writer.  Please take I don't know anything about the scripts (I do not at all understand the language but I know how set up properly).

    For example, that you have offered, this control regime can be achieved using Actionscript tweening the property x of the movieclip (s).  Each interpolation could be triggered by a button and start the object moving from its current x position and move it to a pre-defined position x.

    Here's a simple example using the built-in Tween of Flash AS3 class.  You will get better performance by using a third party like TweenLite tweening engine.  The buttons are movieclips with instance 'btn0' and 'btn300' names and the movieclip in composeepar is called "mc".  If you create these three objects and assign names to them, the following should be the mc will move when you click the buttons.

    Import fl.transitions.Tween;
    Fl.transitions.easing import. *;

    var tw:Tween; declare the interpolation

    MC.x = 150; a starting position

    assign values that the mc will move to each button
    btn0.finalX = 0;

    btn300.finalX = 300;

    assign listeners to events for the buttons, they can use the same handler function

    btn0.addEventListener (MouseEvent.CLICK, moveMC);
    btn300.addEventListener (MouseEvent.CLICK, moveMC);

    function moveMC(evt:MouseEvent):void {}
    var finalX:Number = evt.currentTarget.finalX;
    TW = new Tween (mc, "x", Regular.easeOut, mc.x, Flex418, 1, true);
    }

    If you have any questions about the code, try the search using the Flash help documentation.  Everything is explained here and learn how to help documents is like any other imprtant thing.

    The interpolation could also be made using other approaches based on the code, but what is stated above is probably the sdimpolest to help you get started.

Maybe you are looking for

  • After (or during) computer running firefox some game crashes

    This occurs with only one game in particular. I can play the game once I started the computer. If I run Firefox (or even spin it) then try to sart the game the computer completely freezes and I have to turn off the power to restart the system.

  • I touch air

    boyfriend has I air cushion, when he visits to some sites, it gets a pop up that says that Apple wants $500 sent to them threw Richards or something like that or they will take more comp.well I went on settings and then safari and deleted and erased

  • iPhone videos don't import is not iPhoto but are no longer on iPhone

    My videos from the iPhone are not imported into iPhoto. I tried the photo stream as well as manually import via USB. However, the problem is really in the fact that the thumbnails are still on my phone, but not readily available to share. For example

  • E locking with motorcycle problems

    When I try to charge my phone always the lock is to be unlocked and after full load when I disconnect the same term continues and I have to restart the phone to recover from this issue. Please help me...

  • Replacement of the ink cartridges for HP Photosmart6520

    How will I know who needs color replacement