1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

SQL comparison with multiple updating

Discussion in 'Site Announcements and Feedback' started by echo2005, Dec 1, 2013.

  1. echo2005

    echo2005 Guest

    Hi experts,
    I am dot.net developer and working on a screen with gridView. In GridView each row has 2 buttons: Edit & Delete. I am using Oracle version 11.
    When user click “Delete” on any row, the row is deleted and the screen is refreshed at run time. Below is the Query:
    Update myTable
    SET PROJECT_DISPLAY_NBR = PROJECT_DISPLAY_NBR - 1,
    UPDATE_DTTM = '16-AUG-2013', UPDATE_USER = ‘ANY.NAME’
    WHERE PROJECT_DISPLAY_NBR >= '2' AND PROJECT_SEQ_ID = 40819; --Project_display_Nbr 2 is row 2 selected to delete.
    I can’t figure out a way to use a Query for Editing.When user clicks Edit and changes the date in the row, then 2 steps (I am thinking C# not Oracle) should happen: 1) Compare the date of the row changed with the dates of the rest of the rows (up & down). 2) If the date that is updated is less than the above row (as an example) then the “project display nbr” is also updated as in the example below:
    Start date, project_Display_nbr, Name
    07/07/2013 1 Name1 Top row is not editable
    07/09/2013 2 Name2 Edit Delete
    07/11/2013 3 Name3 Edit Delete (date is changed to 07/08/2013).
    07/15/2013 4 Name4 Edit Delete
    07/20/2013 5 Name5 Edit Delete

    The screen is refreshed at run time with the new updated row:
    Start date, project_Display_nbr, Name
    07/07/2013 1 Name1 Edit Delete
    07/08/2013 2 Name3 Edit Delete (after date is changed, 3 becomes 2).
    07/09/2013 3 Name2 Edit Delete (2 becomes 3)
    07/15/2013 4 Name4 Edit Delete
    07/20/2013 5 Name5 Edit Delete
    I am not much familiar with advanced Oracle but appreciate any help to resolve this issue with example.
    Thanks