Trying to update a field with the RANK function

Hello world

I'm trying to update a field using a PL/SQL function rank. When I'm doing it, I get a "+ ORA-01427: einreihig subquery returns more than one row +", and it's just that sometimes I have the same value more than once.

All the world is facing this issue before? I mean try to update a field using the RANK function?

Please don't hesiate to contact me, if any additional information is required.

Best regards.

UPDATE spd_f_mkt_DC_2
SET RANKING_ID =)
SELECT PLUS RANK()
(
KPI_MKT_ID PARTITION
ORDER BY F_MKT_KPI DESC
)
OF SPD_F_MKT_DC_2
)
UPDATE  spd_f_mkt_DC_2 a
   SET RANKING_ID = (
                     SELECT  rnk
                       FROM  (
                              SELECT  ROWID rid,
                                      RANK() OVER(PARTITION BY KPI_MKT_ID ORDER BY F_MKT_KPI DESC) rnk
                                FROM  SPD_F_MKT_DC_2
                             )
                       WHERE a.ROWID = rid
                    )
/

SY.

Tags: Database

Similar Questions

  • Update of column with the rank on the parition

    Hi, I have a table A given as:
    MASTER_ID, CHILD_ID
    100...
    100...
    100...
    101...
    101...
    102...
    102...
    102...
    102...

    The initial values of CHILD_ID are garbage and should be updated as follows:
    For each unique MASTER_ID the CHILD_ID should have values beginning with 1 (with lowest rowid)
    so when this column is updated the table should look like:
    MASTER_ID, CHILD_ID
    100, 1
    100, 2
    100, 3
    101, 1
    101, 2
    102, 1
    102, 2
    102, 3
    102, 4

    Select MASTER_ID, CHILD_ID,
    Rank() over (partition by MASTER_ID order by rowid) as rank
    a.

    give the good ranking, but when I try to update the CHILD_ID with this rank

    Update)
    Select MASTER_ID, CHILD_ID,
    Rank() over (partition by MASTER_ID order by rowid) as rank
    of (A)
    Set CHILD_ID = row_id

    I get the error:
    SQL error: ORA-01732: non-legal data manipulation operation on this point of view
    01732 00000 - 'operation not legal data manipulation on this point of view'

    Can you please help me with an sql update to set this child_id?
    Thank you
    create table masta
    (
       pk_id number,
       ch_id number
    );
    
    insert into masta values (1, 0);
    insert into masta values (1, 0);
    insert into masta values (1, 0);
    
    insert into masta values (2, 0);
    
    ME_XE?merge into masta m
      2  using
      3  (
      4     select
      5        row_number() over(partition by pk_id order by 1) rn,
      6        rowid as the_rowid
      7     from masta
      8  ) m1
      9  on
     10  (
     11     m.rowid = m1.the_rowid
     12  )
     13  when matched then update set m.ch_id = m1.rn;
    
    4 rows merged.
    
    Elapsed: 00:00:00.14
    ME_XE?select * from masta;
    
                 PK_ID              CH_ID
    ------------------ ------------------
                     1                  1
                     1                  2
                     1                  3
                     2                  1
    
    4 rows selected.
    
    Elapsed: 00:00:00.21
    ME_XE?
    

    Ideally, you do not want to fix the application so that 'unwanted values' are not met initially in the table.

  • Script for updating a field for the current year

    Is it possible to have an update of field at the end of the current year? Example 20-(dashes to change it for any year). I think that it is not possible, but if anyone knows how this is possible I'd really appreciate help. Thank you

    Sorry, I guess I need to change throughout the year, not only at the end.  Thank you

    I tried a few scripts that I found here, such as; year (dateAdd ("yyyy", 1, now()))) with no luck. I confess that I don't know about scripts and can be a bad thing. The script goes on the Action tab as a javascript or somewhere else (validation?) Any advice or assistance would be appreciated. I use Acrobt Pro version 9.

    Going by your post you wanted the year is displayed in a text field, I gave the code to go into the script will count for this field. If you want to use it somewhere else (e.g. a mouseup), then use the variable 'year' in this script. In a calculation script, any value you assign to "event.value" is what will show on the field during the calculation.

  • Update one field with another (which contains a timestamp)

    Hello

    I try to do what I thought, it was a simple task to update my db using the content of another, a field

    in my tbl_profiles I have:

    key | penSignedIn | lastSignedIn
    73. 2006-05-19 21:14:56.0

    I'm trying to update my table for the tbl_profiles.penSignedIn field is populated with the contents of tbl_profiles.lastSignedIn

    < cfquery datasource = "nya" >
    UPDATE tbl_profiles
    SET PenSignedIn = #rs_user.lastSignedIn #.
    WHERE profileID = 73
    < / cfquery >

    I get this error SEE "syntax error (missing operator) in query expression ' 2006-05-19 21:14:56.0'.»»

    and says CF "" SQL: UPDATE tbl_profiles SET PenSignedIn = 2006-05-19 21:14:56.0 WHERE profileID = 73 ".

    that looks ok to me! I have attached different formats such as
    SET PenSignedIn = {ts ' #MM_rsUser.lastSignedIn # '}
    SET PenSignedIn = #MM_rsUser.lastSignedIn #.
    SET PenSignedIn = ' #MM_rsUser.lastSignedIn # '.

    but none seem to not work that leads me into the wall! -can someone please point me in the right direction please

    Thank you so much.
    I have CF7 and database access

    If you try just to update the content of the column penSignedIn with the contents of the lastSignedIn column in the same table, follow these steps:


    UPDATE tbl_profiles
    SET PenSignedIn = lastSignedIn
    WHERE profileID = 73

    Otherwise, if you try to use the value of a variable, maybe you create a date/time object:


    UPDATE tbl_profiles
    SET PenSignedIn = #createodbcdatetime (rs_user.lastSignedIn) #.
    WHERE profileID = 73

    Phil

  • I've updated for picture with the captain and when I plug in my iPhone it loads the same pictures twice each time how it stop loading the same things every day?

    I've updated for picture with the captain and when I plug in my iPhone it loads the same pictures twice each time how it stop loading the same things every day?  I tried to make the old default iphoto but picture still open when I plug in my iPhone?

    I tried to make the old default iphoto but picture still open when I plug in my iPhone?

    When the iPhone is connected and Photos opens, select iPhone in sideba of the windowr of Photos. Then, uncheck the option 'Open for this iPhone Photos' below the toolbar.  Do this for all your iPhones. The hook should be unmarked for each device individually.

  • Tab automatically when you reach the end of a field with the number of limited characters

    Hello!

    Is it possible to activate an automatic tab behavior when the user reaches the end of a field with the number of limited characters?

    I'd like the cursor to move to the next field in tab order automatically.

    Possible?

    Thanks for the tips!

    Marcos

    Hello

    What happens if you tried something like the following example? This works using formCalc on the change event for the user's domain is currently typing in:

    fullCount var = 3
    var currentString = xfa.event.newText
    If (Len (currentString) > = fullCount) then
    xfa.host.setFocus ("TextField2")
    endif

    Or, if you prefer javaScript:

    fullCount var = 3;
    var currentString = xfa.event.newText;
    If (currentString.length > = fullCount) {}
    xfa.host.setFocus ("TextField2");
    }

    These work very well.

    I hope this helps!

    Stephen

  • SVN: #155021. You cannot update this file with the help of Dreamweaver Subversion integration because a new Subversion client application on your machine has made updates to the file Subversion meta data. For more information on this problem

    Can Hello anyone help?

    After you configure Subversion in Dreamweaver, I get this error again!

    SVN: 155021 #. You cannot update this file with the help of Dreamweaver Subversion integration because a new Subversion client application on your machine has made updates to the file Subversion meta data. For more information about this issue, see http://www.adobe.com/go/dw_svn_en.

    even after following the instructions http://www.Adobe.com/go/dw_svn_en Download the extension, python change the var in windows to say «;» C:\Python26'

    with & without quotes, with or without; before C

    command > comparability of Subversion to get the following error "the Conversion process has failed. Please make sure you have Python installed and you check Python PATH parameter'

    I managed to get all the files after the installation, I locked, unlocked and commit a file to test fact so that was all works well, the only part I'm not retrieves the latest version, this is because Subversion is 1.6.2 and dreamweaver must revert to the version 1.4.5 on local to work, the compile someone at - it an idea what to try next in order to make it work?

    Just a reminder!

    1. I configure Subversion through guidelines on http://help.Adobe.com/en_US/Dreamweaver/10.0_Using/WS80FE60AC-15F8-45a2-842E-52D29F540FED. html
    2. I managed to get the latest SVN version
    3. Lock, unlock and commit a file
    4. Installed Python in C:\Python26 change the path in windows system properties > advanced > Environment Variables > system variables > New > Python =; C:\Python26 also C:\Python26
    5. I also tried the same thing in the User Variables
    6. Installed the extension DW Subversion compatibility

    7. Tried to run the compatibly with the command > Subversion comparability in DW

    Welcome any suggestion to solve this?

    Hello

    There has been a lot of problems using svn with dw, and I know many people who have stopped trying to operate correctly.

    As much as I know dw will not work with newer versions of svn (over 1.5), and even then, there are a lot of problems, a possible solution is to try subweaver (at- http://code.google.com/p/subweaver/ ), as this has solved some of the problems associated with the use of tsvn dw environment.

    PZ

  • I have iphone 4s, icloud locked trying to get in touch with the owner to give it back or unlock it he won't talk, it's gsx is useful in this case? owner is not interested in the phone!

    I have iphone 4s, icloud locked trying to get in touch with the owner to give it back or unlock it he won't talk, it's gsx is useful in this case? owner is not interested in the phone! and he has been blocked me on whatsapp about 6 times when I tried to get in touch with 6 different number what can I do I login apple, name and telephone number of the owners, in the name of the country

    anyone here to help me? am ready to give her phone or money for if it unlock the phone

    * someone sell me the phone on class based internet site

    Thank you

    It's between you and him, Apple won't help you. So if he wants too that the phone doesn't help you, I advise you to stop bothering him, it's a little cheesy, don't you think?

  • Updated my iPad with the new OS.

    Updated my iPad with the new OS. Initially it lights, so I have two buttons held together and finally happened. Now it is stuck on the screen with the time and will not move forward, nor is it resets. Is there any solution for this?

    Thank you

    Kat

    Try a forced reboot. Hold down the home and Sleep/Wake buttons simultaneously for about 15-20 seconds , until the Apple logo appears. You won't lose anything.

    If a force restart does not help try recovery Mode:

    https://support.Apple.com/en-us/HT201263

  • I'm trying to update my phone.  The only list update is iOS 9.2.1.  When I try to update, it tells me that I can't because I am not connected to the internet.  How can get the update on my phone.

    I'm trying to update my phone.  The only available update is iOS 9.2.1.  When I try to upgrade, it tells me that I can't upgrade because I am is no longer connected to the internet.  How can I upgrade my phone?

    Connect to the internet.

  • Dvd player MediaSmart not working - when a Blu - ray Disc I'm invited to be updated, but even with the update it will not play.

    I have laptop HP Pavilion dv7-1260.  When I put in a blu - ray disc I'm propmted to get an update.  Even with the update, it will not play a blu ray.

     

    Hello

    ·         What is the update message that you receive?

    ·         Do you have an error message when you try to read the Blu - ray Disc?

    ·         This problem occurs only with Blu ray discs or any of the others?

    To play a Blu - ray disc, you must use a non-Microsoft program that supports Blu - ray playback and a device that can play Blu - ray discs.

    See the link below:

    http://Windows.Microsoft.com/en-us/Windows7/MPEG-and-DVD-video-frequently-asked-questions

  • I'm trying to reinstall windows vista with the cd that hp sent me.

    I am trying to reinstall windows vista with the cd that hp sent me and he used to in stall, I had to have a new hard drive put in and I'm trying to put vista in and I can't help please

    If you have problems with the HP recovery disk, you will need to contact HP.

    This is HP Recovery Media, not Microsoft.

    HP Contact Info:

    http://welcome.HP.com/country/us/en/contact_us.html

    See you soon.

    Mick Murphy - Microsoft partner

  • Fill a field with the results of the other (sort and add custom text)

    I have a PDF form with many fields popup asking 'Yes', 'Maybe' or 'no '. I need a way to collect the answers and sorting, all the 'yes' first of all, that all the 'maybe', all the 'no '. When I need after that sort of response of three, is put in a 'Results' field with the container of the ToolTips for each popup and the ability to add a "BOLD" text, between three sorted responses.

    I have found some javascript in the forum here to collect data from field only. It seems to be easy to modify if you have several fields to collect/sorting/extract.

    Assistance or management to do will be appreciated.

    Thank you!

    Assuming that you have 50 menus named A1, A2... A50 and each drop-down list has three elements (Yes, maybe, no), you could do something like:

    Initialize object to contain the info of the answer

    var oResponse = {}

    'Yes': [],.

    "Maybe": [],.

    ['No':]

    };

    var i, f;

    Browse fields (A1, A2... A50)

    for (i = 1; i<= 50;="" i="" +="1)">

    Get a reference to the current field

    f = getField ("A" + i);

    Add ToolTip text of the current field to the corresponding table in the response object

    oResponse [f.valueAsString] .push (f.userName);

    }

    Generate the output string

    aOutput var = [];

    If (oResponse ['yes'] .length > 0) aOutput.push ("It's the priority YES\r" + oResponse ["Yes"] .join ("\r"));

    If (oResponse ["Maybe"] .length > 0) aOutput.push ("It's the priority MAYBE\r" + oResponse ["Maybe"] .join ("\r"));

    If (oResponse ['No'] .length > 0) aOutput.push ("It's the priority NO\r" + oResponse ["No"] .join ("\r"));

    Enter the results

    getField("Results").value = aOutput.join("\r\r");

  • I'm looking to have an input field with the search button, search button click the search button below the search results to display. How can I do?

    I'm looking to have an input field with the search button, search button click the search button below the search results to display. How can I do?

    Hello

    998765 wrote:

    You are right

    Please pass by the database 2 day + Application Express Developer's Guide

    Check this code example

    1 create a text field element I say P1_INPUT_FIELD

    2. create a button

    Name of the button: search

    Action: Send the page

    3. change your report query and where clause to your query below

    It will search on ename and empno, in this way, you can add more columns

    SELECT EMPNO
               , ENAME
               , SAL
               , MGR
               , COMM
      FROM EMP
    WHERE TRIM(UPPER(ENAME)) like '%' || TRIM(UPPER(:P1_INPUT_FIELD)) || '%'
           OR TRIM(UPPER(EMPNO)) like '%' || TRIM(UPPER(:P1_INPUT_FIELD)) || '%'
    

    4. we find the source of the region-> page article to submit-> P1_INPUT_FIELD

    Hope this helps you,

    Kind regards

    Jitendra

  • I get a Script Error failed. I think it is because the domain name is on page 1 and the field with the calculation is on page 2.

    I get a Script Error failed. I think it is because the domain name is on page 1 and the field with the calculation is on page 2.

    The formula is just + Cash.  I don't know how to tell him to look on Page 1.  If I use the same domain on Page 1, the formula works so I know that this is not something in the name of the field.

    It received NO response

    Page1.cash should do it. If not, you can use CTRL + click to enter its name in your script.

    1. Select the field that you add the script.
    2. Scroll the design view until you can see the object whose name you need. (Is not necessary if the object is already in mode)
    3. Click inside the script window to place the cursor where you want the name of the other object.
    4. Hold down the CTRL key while clicking the object whose name you need.

Maybe you are looking for