How to update ordered list having a constraint

hi friends,
I have to update a column for all the records in the table with a unique contraint
ex-- select rec_no from tablename;
9
8
7
6
5
now i have to update this like
select rec_no from tablename;
8
7
6
5
4
but when i am doing update tablename set rec_no=rec_no-1
i am getting unique constraint error
plz help me

dj wrote:
but when i am doing update tablename set rec_no=rec_no-1
i am getting unique constraint error
No you don't. Show us.
Oracle ensures "statement level constraint" consistency. If you do this in one update statement (which is what you state above), then Oracle will not give you a constraint error.
For if it did, then we all would have a serious problem: whether or not the update succeeds would then depend on the order in which Oracle (ie. the execution plan) happens to update the rows. And we can't have such 'undeterministic' behavior (similar to what we would have when Oracle did not provide us with the mutating table error...).
So just try it, or show us:
create table uk_test
(i number not null unique)
insert into uk_test values(4);
insert into uk_test values(3);
insert into uk_test values(2);
commit;Now try both of these:
update (select * from uk_Test order by i desc) set i=i-1;
update (select * from uk_Test order by i) set i=i-1;They both succeed. Oracle allows temporary constraint violations during/inside the execution of one statement. There is no need to set this constraint to deferred here.
I talk about statement level constraint consistency here too:
http://rulegen.blogspot.nl/2012/01/statement-level-constraint-validation.html

Similar Messages

  • Updating Ordered List View

    Hi,
    In our report , we are using updating ordered List View. In this view we specified sort conditions on some fields which does the default sorting when report gets generated.
    Now, the user would like to sort the results by clicking on the column name at run time. How do we achieve this functionality in this view ? If not , is there any alternative view available ?
    Thanks,
    Satish

    I think in the current version - sorting as a enduser-function is not available.

  • Workflow - how to update multiple list items

    Is it possible to update up to 3 list items with the same information using a workflow?  My scenario is where a company vehicle (registration number) has up to three drivers assigned to it - Driver Name 1, Driver Name 2 and Driver Name 3.   I
    have two separate lists - one for vehicles (fleet list) and one for drivers (driver database).  In my workflow when an item is created or changed in the fleet list, I would like the current vehicle registration to be updated in all three driver records
    in the driver database.  I am not sure if I can do this as I am unsure of what my unique look up would be as I need to be able to tie a vehicle registration to a driver name. Any advice would be much appreciated.
    Thanks

    Hi,
    Refer to the following threads about how to update multiple list items simultaneously.
    http://social.technet.microsoft.com/Forums/en-US/936d05ba-6e86-4f44-bbdb-b3c5c12b2c68/how-do-i-update-multiple-list-items-at-once-in-a-sharepoint-list
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2d342b01-1978-40c9-a203-303d145b331e/how-to-update-mulitple-list-items-at-same-time
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/8d5b7424-58dc-470b-8142-90755dbdeaae/sharepoint-workflow-change-multiple-items-in-other-list
    Thanks.
    Tracy Cai
    TechNet Community Support

  • How to update 500 list items using Rest API

    Hi All,
    i have requirement that is "required to update 500 list items using rest Api".
    how can i do it,please share your thoughts with me.
    Thanks,
    Madhu.

    Didn't get you correctly, if you asking reference for REST API to update list items please refer below links
    http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
    Destin -MCPD: SharePoint Developer 2010, MCTS:SharePoint 2007 Application Development

  • How to update selected list items in SharePoint 2010?

    Hello All
    I have a list containing field named "Category". I want to develope a solution which will take two inputs: Old Category and New Category. The expected result is: all the list items will be fetched which have Old Category input value in
    their category field and the field is replaced with the input value New Category.
    I have a limitation that I can not use Visual Studio. So I am thinking to create aspx page with content editor webpart. But I am new to all these things. Could you please suggest the development approach for this?
    Thanks.

    Hello,
    I don't think CEWP can help you because you won't be able to find old and new category when there is any change in list. However you can identify the latest modified item from list but how will you identify whether category is old or new. If you have any
    other column in list which can tell you that category value has been updated then you can write ECMA or Jquery script to update other items.
    If have any column in list then see below jquery code, where you will see how to query the list: (In my case it is Active)
    var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body><GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>";
    soapEnv += "<listName>Highlights</listName>";
    soapEnv += "<query><Query><Where><Eq><FieldRef Name='Active' /><Value Type='Text'>Yes</Value></Eq></Where><OrderBy Override='TRUE'><FieldRef Name='Modified' Ascending='FALSE' /></OrderBy></Query></query>";
    soapEnv += "<viewFields><ViewFields><FieldRef Name='Title'/><FieldRef Name='ows_FileLeafRef'/><FieldRef Name='Links'/></ViewFields></viewFields><rowLimit></rowLimit>";
    soapEnv += "</GetListItems></soapenv:Body></soapenv:Envelope>";
    Please comment if i misunderstood you?
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to add ordered list, subscript in RichtextEditor?

    Hi,
    In the richtexteditor I need to add the ordered list button(like the bullet) and a button for subscript, is ther any way to that.
    I have the information how to add a Find/Replace button.
    Also can anyone provide me the format for ordered list.
    Help me regarding this.
    TIA

    Hi,
    Try this :
    super.processRequest(pageContext, webBean);
    OADefaultListBean list =
    (OADefaultListBean)createWebBean(pageContext, OAWebBeanConstants.DEFAULT_LIST_BEAN,
    null, "popuplist");
    list.setListViewObjectDefinitionName("oracle.apps.per.selfservice.competency.profile.server.CompSearchVO");
    list.setListValueAttribute("compType");
    list.setListDisplayAttribute("compType");
    list.setMultiple(true);
    list.setName("poplist");
    OAMessageComponentLayoutBean listboxlayout = (OAMessageComponentLayoutBean)webBean.findIndexedChildRecursive("searchFiltersRN");
    if(listboxlayout!=null)
    listboxlayout.addIndexedChild(list);
    Check for the correct id of the OAMessageComponentLayoutBean as this is the correct code to add the list bean.
    Thanks,
    Gaurav

  • Design question - how to update a list?

    Hi there,
    design question: I have a table with the following columns:
    1. id
    2. ref_number
    3. ticket_number
    example:
    1 60 234
    2 60 256
    3 60 664
    4 60 237
    consider this - user can see on the screen the list of all tickets associated with ref_num (in the example above everything associated with 60)
    now I would like to UPDATE the list. The user might have added more to the list or, alternatively, remove from the list.
    The easiest thing to do is to DELETE all the list with ref_number=60 and then do INSERT
    Q: is this ok? if not, how would you update such a list if I don't have the id's of every row?
    thanks

    If you want to write code that's easier for you to write, you do whatever the hell you want.
    If you want to write good code, retain the ID.

  • How to update SharePoint list columns including choice fields programmatically?

    Hi All,
    I have a requirement to update multiple columns (which are choice columns) in a SharePoint list.  I'm a newbie at creating event receivers and timer jobs.  Not sure which one to do and where to start first.  There are approximately 4500
    list items in the lists.  I was thinking I could use one list to maintain the Keywords and perform updates or timer job to any targeted lists. 
    Scenario.  Anytime a power user of the sharepoint list wants to update any of the choice field items or possibly even the column name itself, they want to be able to make updates to any of the list
    items or other
    lists that contain the new name.  The columns I'm using are all choice fields named Assigned To, Division, Region, Job Title, Department, and Zone.
    Here's sample code for Updating list:
     using     (SPSite oSPsite = new SPSite("team url/"))   
     using     (SPWeb oSPWeb = oSPsite.OpenWeb())         
     oSPWeb.AllowUnsafeUpdates =   true;          
     // get the List                
     SPList list = oSPWeb.Lists["Keywords"];        
     //Add a new item in the List                
     SPListItem itemToAdd = list.Items.Add();               
     itemToAdd["Title"] = "My Title Field";               
     itemToAdd["Assigned To"] = "Assigned To";               
     itemToAdd.Update();          
     // Get the Item ID               
     listItemId = itemToAdd.ID;          
     // Update the List item by ID                
     SPListItem itemToUpdate = list.GetItemById(listItemId);               
     itemToUpdate["Assigned To"] = "Assigned To Updated";               
     itemToUpdate.Update();          
     // Delete List item                
     SPListItem itemToDelete = list.GetItemById(listItemId);               
     itemToDelete.Delete();                   
     oSPWeb.AllowUnsafeUpdates =   false;         
    Any help is greatly appreciated.  Please provide code sample and references.  Thanks!

    Thanks Ramakrishna -- Here's what I have so far.
    namespace MonitorChanges
            class MyTimerJob : SPJobDefinition
                public MyTimerJob()
                    : base()
                public MyTimerJob(string sJobName, SPService service, SPServer server, SPJobLockType targetType)
                    : base(sJobName, service, server, targetType)
                public MyTimerJob(string sJobName, SPWebApplication webApplication)
                    : base(sJobName, webApplication, null, SPJobLockType.ContentDatabase)
                    this.Title = "My Custom Timer Job";
                public override void Execute(Guid contentDbId)
                    // Get the current site collection's content database           
                    SPWebApplication webApplication = this.Parent as SPWebApplication;
                    SPContentDatabase contentDb = webApplication.ContentDatabases[contentDbId];
                    // Get a reference to the "ListTimerJob" list in the RootWeb of the first site collection in the content database           
                    SPList Listjob = contentDb.Sites[0].RootWeb.Lists["ListTimerJob"];
                    // Add a new list Item           
                    SPListItem newList = Listjob.Items.Add();
                    newList["Title"] = DateTime.Now.ToString();
                    newList.Update();
    Talibah C

  • How to update the lists using the timer jobs?

    Hi,
    I'm new to sharepoint developing
    Using the timer jobs the items which are present in the one list must get updated in the another list and also should be overwritten.
    For example:
    If there 10 items present in a X list. After some time period the first five of X should get updated in Y  list . After some more time the next 5 items of X has to overwrite the items present in the Y list.
    Regards,
    Santto.

    Hi Santto,
    The following articles and code examples would be helpful.
    SharePoint 2010 Custom Timer Job
    https://code.msdn.microsoft.com/office/SharePoint-2010-Custom-416cd3a1
    SharePoint Add/Update/Delete List Item Programmatically to SharePoint List using C#
    http://www.sharepointblog.in/2013/04/add-new-list-item-to-sharepoint-list.html
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to update order of Characterstics in LIS structure?

    Hi.
    Hi.
    We have added an additional key figure to a custom LIS structure after it was created. Before the update the characteristics were in the following order:
    Client
    Period
    Characteristic 1
    Characteristic 2
    Version
    Month
    Date
    Week
    Stat(s) source
    Key Figure 1
    Key Figure 2
    After the update we clicked the generate button to activate the updated structure. Now the order is:
    Client
    Stat(s) source.
    Version
    Period
    Month
    Date
    Week
    Characteristic 1
    Characteristic 2
    Key Figure 1
    Key Figure 2
    Key Figure 3
    Do you have any solution on how to re-arrange the key figures?
    Thanks
    Anke

    Hi Warwick.
    Oops, sorry for the typo.
    I am not tryin to reorder he keyfigures, but the characteristics:
    From
    Stat(s) source.
    Version
    Period
    Month
    Date
    Week
    Characteristic 1
    Characteristic 2
    To
    Stat(s) source.
    Version
    Characteristic 1
    Characteristic 2
    Period
    Month
    Date
    Week
    Thanks
    Anke

  • How to update a list in parent view with data from child view/window ?

    I have a view named AccountListView that displays some buttons and a list of accounts.Its viewmodel is called AccountListViewModel and has a collection : ObservableCollection<AccountViewModel>. What I'd like to acomplish: whenever I press the Add/Edit
    Button from the AccountListView to open a new window/usercontrol, i.e. AccountView and bind it to an instance of AccountViewModel that will have some fields to fill in and a Submit and Cancel buttons. How can I update the ObservableCollection<AccountViewModel>
    from  inside the child view, so when I click on the Submit button from AccountViewModel it will return an AccountViewModel object with the data I filled in and add it to the observablecollection. Would notifications from prism be the right way ? Should
    I include code from the AccountListViewModel and AccountViewModel ?

    The way to communicate between view models in Prism is to use the EventAggregator. You raise an event from view model A and subscribe and handle this event in view model B. I have written a blog post about it which should be helpful here:
    http://blog.magnusmontin.net/2014/02/28/using-the-event-aggregator-pattern-to-communicate-between-view-models/.
    In your case you could define an event that carries an AccountViewModel object and pass this one from view model A to view model B:
    public class AccountViewModelEvent : CompositePresentationEvent<AccountViewModel>
    Please refer to the blog post for more information and a complete code example.
    Hope that helps.
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

  • How to update agent list after triggering workflow?

    Hi Guys,
               Is there any function module to update the agent list after triggering the workflow? i mean after triggering workflow, the user is maintaining some approving officers in their table and they are expecting the workflow should route the workitem to  those newly maintained approving officers. So can any one help me to solve this issue.
    Regards,
    Safiq

    if any agent maintained in the customized table, how can I update
    those agent with existing available agent list.
    It sounds like updating the existing workitem container with the new updated values. right? You mean to say initially workflow is triggered and the agent list is populated in the workflow container. But after the workflow is triggered if the table is updated with some new entries, then these new entries must alos be included in the agent list container element in the workflow container.
    If this is the case the you have to modify the multiline container element of the workitem container. You can make use of the standard function module SAP_WAPI_WRITE_CONTAINER but this function module needs to be called each time when evenr a new entry is created and you have to check what are all the workitems that you want to update ,
    I think its a bit difficult to update all the workitems which are with reagrd to this scenario.. so you have to check out some other simple way. But on a whole what I can say is you can update an existing workitem container by using the FM mentioned above...

  • How to update device list in MAX ?

    Hi all,
    I'm running MAX 4.0.3 and trying to declare cFP module (that I still haven't received).
    I'm expecting :
      2 RLY 421 modules,
      1 AI 111,
      1 DO 401,
    they'll be connected to a cFP 2020.
    The thing is when I try to add a device I have to select from a list but RLY 421 is not in that list..
    How can I update MAX's device list ??
    Message Edité par TiTou le 07-19-2006 04:21 PM
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    cFP.jpg ‏21 KB

    Hello,
    I've just installed FieldPoint Driver 5.0 downloaded from NI website but the RLY 421 is still not in the device list ...
    Before starting to develop I thought I should update my drivers so I got the latest FP Driver version, but since I'm still using LV 7.1 maybe I shall unistall FP Driver 5.0 and re-install 4.1 and see if it works  ?
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"

  • How to update Locator & lot_control having transaction exists

    Dear,
    We have to set item on lot_control & locator control base while these item has alread balance exists in transaction table like quantity in hand, now could you please advice how could it possiable to update flag without removing qty or balance.
    Thanks

    Hi Suresh
      this is actual requirement
    in the CAT2.
    1. Add a new column for WBS description and derive the value as per the FS
    2. Retrieve project number and description and update in the column specified
    3. When a service order is selected it should do the same for 2.
    4. Finally repeat for the worklist view (which is the section above)
       here i am able to display values at data entry area
    for service order and network but not worklist area ?
        updation is not coming, can u plz go throw it..
    Thanks
    Chinna

  • How to Update Comment List in Reader

    I have written a plug-in that manages user annotations. The issue that I have is I am able to manipulate the annotations on the page, but the information in the Comment List does not update. Is there a seperate array for what shows up in the comment list or is there a call that I can make to refresh the comment list?
    Any assistance is very much appreciated.
    Gregory

    Hello,
    I've just installed FieldPoint Driver 5.0 downloaded from NI website but the RLY 421 is still not in the device list ...
    Before starting to develop I thought I should update my drivers so I got the latest FP Driver version, but since I'm still using LV 7.1 maybe I shall unistall FP Driver 5.0 and re-install 4.1 and see if it works  ?
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"

Maybe you are looking for