Updating neighboring records in no key table

I have Table1 with 3 fileds: Field1, Field2, Field3. There is not key in the table.
I need to do the following:
If the Field2 equals 'A', the same field of the next record should be set to 'B'.
If the Field3 equals 'F', the same field of the previous record should be set to 'E'
For example:
Field1 Field2 Field3
=====  =====  =====
123     A    D
124     R    F
123     N    M
121     A    F
123     C    B          Should become
Field1 Field2 Field3
=====  =====  =====
125     A    E
126     B    F
123     N    E
121     A    F
124     B    B          Please advise on how to do this.
Thanks.

A natural order to rows in an Oracle heap table is a complete fallacy. If my table space has 100 blocks and my table starts at block 40 and goes to block 45, then someone drops or truncates a table at block 20, now my table takes an extent and is allocated blocks 20 through 25. Now when I select from the table and Oracle does a full table scan, I am likely to get rows from blocks 20 - 25 before the rows from blocks 40-45. Of course if rows are deleted and more rows inserted, then this too will affect the order in which rows are returned.
There is no guarantee that Oracle will return rows in the order in which they were inserted.
So, you need information in the row to tell you the sequence in which to return them.

Similar Messages

  • Deleting and updating records in a database table

    dear all ,
    i have created a databse table to which i have to update and delete records thru my program whixh i am unable to do so plz help me.

    Hi Sonu,
    To delete and update the records in your database table, you can create a Function Group and all the necessary function modules for it. This will a good approach as this will separate the database interface logic and the business logic. You need to use the DELETE and UPDATE ABAP keywords to delete and update the records of the database tables. Have a look at the ABAP Keyword documentation for a complete details of the usage.
    Have a look at the following link:
    DELETE
    http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3aef358411d1829f0000e829fbfe/frameset.htm
    UPDATE
    http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3aef358411d1829f0000e829fbfe/frameset.htm
    Hope this will help.
    Thanks,
    Samantak.

  • Server java trace error while updating bulk records from AIX to Oracle 10g

    Hi
    I am getting an error in TCL (Tool Command language) script that updates the records in a database table i.e around 2500 records are to be updated. I am using update statement with bind variables to insert the data.
    SQL "insert into netuser.visit_temp (FP_FROM,FP_TO,HOPS,FP_FROM_ID) values (:SN,:EN,:HP,:FPID)" [list SN $startnode EN $endnode HP $hops FPID $fpId]
    However, after processing 900 or so records (takes around 8 hours) I get the following error:
    environment variable "SERVER_JAVA_TRACE" undefined
    while executing
    "getenv SERVER_JAVA_TRACE"
    invoked from within
    "dotransaction {
         logm "Processing $fp"
         set value [SQL $query3 [list FP $fp]]
         logm "Found value $value"
         set fpid [Koplingspunkt quer..."
        ("foreach" body line 3)
        invoked from within
    "foreach fp $cmd2 {
         UtilityObject cleanCache
         dotransaction {
             logm "Processing $fp"
             set value [SQL $query3 [list FP $fp]]
         logm "Found v..."
    Could anyone please suggest the possible cause of error?

    Not a Java question. Locking.

  • Unable to update a record using PAI, in Module pool

    Hi Experts,
                        I m unable to update the records in to the table using P A I in module pool, could any one help me out dear.
    The prg is as follows:
    INCLUDE MZFIRSTPAGETOP                          .    " global Data
    TABLES: ZCHP_CUST_INFO.
    DATA:   CNAME LIKE ZCHP_CUST_INFO-CREATED_BY,
            REQTYP LIKE ZCHP_CUST_INFO-REQUEST_TYPE,
            DESC LIKE ZCHP_CUST_INFO-SHORT_TEXT,
            PRIO_TYPE LIKE ZCHP_CUST_INFO-PRIORITY_TYPE,
            EFFECTIVE_DATE like ZCHP_CUST_INFO-REQUIRED_STR_DAT,
            COMM_TYP like ZCHP_CUST_INFO-MODE_OF_COMM,
            COMM like ZCHP_CUST_INFO-ADDRESS.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'FOR1000'.
      SET TITLEBAR '1000'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    INCLUDE MZFIRSTPAGEO01                          .  " PBO-Modules     *
    INCLUDE MZFIRSTPAGEI01                          .  " PAI-Modules     *
    INCLUDE MZFIRSTPAGEF01                          .  " FORM-Routines   *
    *&      Module  USER_COMMAND_1000  INPUT
          text
    MODULE USER_COMMAND_1000 INPUT.
    CASE SY-UCOMM.
      WHEN 'SUBMIT'.
    Updating the record.
            ZCHP_CUST_INFO-REQ_NUM = C_KNUMV.
            ZCHP_CUST_INFO-CREATED_BY = CNAME.
            ZCHP_CUST_INFO-REQUEST_TYPE = REQTYP.
            ZCHP_CUST_INFO-PRIORITY_TYPE = PRIO_TYPE.
            ZCHP_CUST_INFO-SHORT_TEXT = DESC.
            ZCHP_CUST_INFO-CREATED_ON = EFFECTIVE_DATE.
            ZCHP_CUST_INFO-MODE_OF_COMM = COMM_TYP.
            ZCHP_CUST_INFO-ADDRESS = COMM.
    INSERT ZCHP_CUST_INFO.
    COMMIT WORK.
    WHEN 'RESET'.
           CLEAR: CNAME,REQTYP,PRIO_TYPE,
    DESC,EFFECTIVE_DATE,COMM_TYP,COMM.
      WHEN 'CANCEL'.
            LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_1000  INPUT
    Thanks in advance,
    Sunil

    Hi Kal chand,
                      This is the whole prg where the records are not updated. But the ref number is updated.
    INCLUDE MZFIRSTPAGETOP                          .    " global Data
    TABLES: ZCHP_CUST_INFO.
    DATA: OKCODE LIKE SY-UCOMM.
    CONSTANTS: LC_NUMBER_RANGE TYPE INRI-NRRANGENR VALUE '01',
               LC_COND_OBJECT TYPE INRI-OBJECT VALUE 'KONV'.
    DATA: L_IS_REPL_DELIV TYPE XFLAG,
          C_KNUMV TYPE I.
    DATA:   CNAME LIKE ZCHP_CUST_INFO-CREATED_BY,
            REQTYP LIKE ZCHP_CUST_INFO-REQUEST_TYPE,
            DESC LIKE ZCHP_CUST_INFO-SHORT_TEXT,
            PRIO_TYPE LIKE ZCHP_CUST_INFO-PRIORITY_TYPE,
            EFFECTIVE_DATE like ZCHP_CUST_INFO-REQUIRED_STR_DAT,
            COMM_TYP like ZCHP_CUST_INFO-MODE_OF_COMM,
            COMM like ZCHP_CUST_INFO-ADDRESS.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'FOR1000'.
      SET TITLEBAR '1000'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    INCLUDE MZFIRSTPAGEO01                          .  " PBO-Modules     *
    INCLUDE MZFIRSTPAGEI01                          .  " PAI-Modules     *
    INCLUDE MZFIRSTPAGEF01                          .  " FORM-Routines   *
    *&      Module  USER_COMMAND_1000  INPUT
          text
    MODULE USER_COMMAND_1000 INPUT.
    CASE SY-UCOMM.
      WHEN 'SUBMIT'.
    *FOR INCREMENTING THE VALUE.
    C_KNUMV = C_KNUMV + 1.
    USED FM TO GENERATE NUMBERS.
    CALL FUNCTION 'NUMBER_GET_NEXT'
         EXPORTING
           nr_range_nr = lc_number_range
           object      = lc_cond_object
         IMPORTING
           number      = c_knumv.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Updating the record.
            ZCHP_CUST_INFO-REQ_NUM = C_KNUMV.
            ZCHP_CUST_INFO-CREATED_BY = CNAME.
            ZCHP_CUST_INFO-REQUEST_TYPE = REQTYP.
            ZCHP_CUST_INFO-PRIORITY_TYPE = PRIO_TYPE.
            ZCHP_CUST_INFO-SHORT_TEXT = DESC.
            ZCHP_CUST_INFO-CREATED_ON = EFFECTIVE_DATE.
            ZCHP_CUST_INFO-MODE_OF_COMM = COMM_TYP.
            ZCHP_CUST_INFO-ADDRESS = COMM.
    *ENDIF.
    INSERT ZCHP_CUST_INFO.
    COMMIT WORK.
    WHEN 'RESET'.
           CLEAR: CNAME,REQTYP,PRIO_TYPE,
    DESC,EFFECTIVE_DATE,COMM_TYP,COMM.
      WHEN 'CANCEL'.
            LEAVE PROGRAM.
    ENDCASE.
    regards,
    Sunil

  • Foreign Key updation in DB while updating the records in referenced table

    Hi
    I am having 2 DB Tables.
    1.Employees
    ID
    FirstName
    LastName
    AddressID
    2.Address
    ID
    City
    State
    Country
    The ID's are generated through Sequences and Triggers.
    I created a VO, and created a form in UI,
    the UI has following inputText
    FirstName
    LastName
    City
    State
    Country
    I entered the information and the data was saved sucessfully in Employees and Address Table.
    But the ForeignKey(AddressID) in Employees Tables which maps between Employees and Address is not set.
    Can anybody let me know how to achieve that?
    Do I need to use Triggers or is there any way to that ?
    If so, It will be more helpful If you can explain me or guide me.
    Thanks

    I have Associations and the viewlink specified.
    Its like the Referencial constraint..
    I am having a Employee and Location details in a VO
    I dragged it in my JSF as a form..
    Employee table has EmployeeID(PK) and AddressID(FK)
    Address table has AddressID(PK)
    now from UI, I can insert the Data like FirstName,LastName,City,State using my VO
    FirstName,LastName --- > Employee Table
    City,State --> Address Table
    For the EmployeeId(PK) and AddressId(PK) I am using Sequence.
    While inserting the data from the UI, through the inputText - FirstName,LastName,City,State-- a row is created in Employee Table and Address Table..
    but the AddressId(FK) in the Employee table is null, because I dint write anything there so as to update AddressID(FK) column in employee table,,, once I get a new row in AddressTable..
    how to acheive this ?
    please guide me..
    Thanks

  • Unique data record means you can't  update a record from ECC with same key.

    Unique data record means you can't  update a record from ECC with same key fileds right?
    Details: For example i have two requests Req1 and Req2 in DSO with unique data record setting checked. on day one Req1 has a filed quantity with value 10 in Active data table. On day two Req1 can not be overwitten from ECC with Req2 with the same key fields but different value 20 in the filed quantity because of the Unique data record settings. finally the delta load fails from ECC going to DSO because of this setting. is it right?
    I think we can only use unique record setting going from DSO to cube right?
    Please give me a simple scenario in which we can use this setting.
    I already search the threads and will assign points only to valuable information.
    Thanks in advance.
    York

    Hi Les,
    Unique Data Records:
    With the Unique Data Records indicator, you determine whether only unique data records are to be updated to the ODS object. This means that you cannot load a data record into the ODS object the key combination for which already exists in the system – otherwise a termination occurs. Only use this setting when you are sure that only unique data records are to be loaded into the ODS object (for example, single documents). A typical application of this is in the loading of mass data. It improves the load performance.
    Hope it Helps
    Srini

  • How to update multiple records in a table created in view (web dynpro)

    Here is my coding......
    *coding to get the district value
    DATA lo_nd_district TYPE REF TO if_wd_context_node.
        DATA lo_el_district TYPE REF TO if_wd_context_element.
        DATA ls_district TYPE wd_this->element_district.
        DATA lv_district_txt LIKE ls_district-district_txt.
      navigate from <CONTEXT> to <DISTRICT> via lead selection
        lo_nd_district = wd_context->get_child_node( name = wd_this->wdctx_district ).
      get element via lead selection
        lo_el_district = lo_nd_district->get_element(  ).
      get single attribute
        lo_el_district->get_attribute(
          EXPORTING
            name =  `DISTRICT_TXT`
          IMPORTING
            value = lv_district_txt ).
    *coding to diplay records when clicking a button(Submit)
    DATA lo_nd_table TYPE REF TO if_wd_context_node.
    DATA lo_el_table TYPE REF TO if_wd_context_element.
    DATA ls_table TYPE wd_this->element_table.
      DATA lv_district LIKE ls_table-district.
    navigate from <CONTEXT> to <TABLE> via lead selection
      lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).
    get element via lead selection
      lo_el_table = lo_nd_table->get_element(  ).
    get single attribute
      lo_el_table->set_attribute(
        EXPORTING
          name =  `DISTRICT`
       " IMPORTING
          value = lv_district_txt ).
    The above coding updates only one record to that
    table created in view.
    If i enter 2nd district value means then the first record
    in the table is overwritten.
    So my need is the record should not be overwritten.
    it(2nd record ) should be displayed after the 1st record.
    Any one can help me and send the coding plz....

    instead of using set attribute you should use bind table method to display/update the records in table view.
    step1 ) collect all the data in a local table
    step2 ) and the bind that lacal table with your node
    search1 = wd_context->get_child_node( name = `TABLE1` ).
    search1->bind_table( lt_detail)
    here lt_detail is your local table and TABLE1 is node which is bound with table ui element.

  • What's the best way to insert/update thousands records in multiple tables

    Can anyone give an example of how to insert/update thousands records in multiple tables on performance wise? or what should I do to improve the performance?
    Thanks
    jim

    You can see a set of sample applications in various scenarious available at
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/content.html

  • Function module or BAPI that is used to update the records in RBKP table.

    Hello All,
    Can anybody please give me the name of any Function module or BAPI that is used to update the records in RBKP table.
    Please help me
      I need to change the fiscal year in RBKP table
    Thanks in Advance,
    Regards,
    LIJO

    Hi,
    You can use the BAPIs,
    BAPI_ACC_INVOICE_RECEIPT_CHECK Accounting: Check Invoice Receipt (OAG: LOAD PAYABLE)
    BAPI_ACC_INVOICE_RECEIPT_POST  Accounting: Post Invoice Receipt (OAG: LOAD PAYABLE)
    Hope this helps.
    Regards,
    Renjith Michael.

  • Update new record in database table

    I'm working with TestStand 4.2 and MySQL database with user-defined tables.
    There is "test_results" table with autoincrement "id" (primary index).
    I want to:
    1. write a new record to the test_results table - some data and status "Running"
    2. run a test (pass to a test sequence its "id", test uses this id for writing data to database)
    3. update the record: set execution time and update status.
    So, the steps are as below:
    1. Open database
    2. Open SQL statement: "select * from test_results".
    3. Data Operation: operation - "Set and Put", record to operate on - "New - Create New Record". In the "Column/Parameter Values" tab I set the new record values.
    Here I want to retrieve the new record "id". How to do it?
    Thanks in advance.

    I am not sure how to implement this in Test Stand, but from an SQL programming perspective, you want to run:
    SELECT @@IDENTITY
    Here is a link to the description:  http://msdn.microsoft.com/en-us/library/ms187342.aspx
    It will retrieve the record ID of the row you just inserted.

  • Should I use BCS my backend database will update all the record of the sql table daily.

    Should I use the BCS where the database table is going to be updated daily.
    All the records will be updated on daily basis.
    Why should I use BCS when I can connect to the sql server directly and  update the records that I need.
    What additional benefits can I get from BCS , I do not need the search functionality.
    Regards

    Hi,
    According to description, my understanding is that you want to know if you need to use Business Connectivity Services to connect external SQL table.
    Business Connectivity Services is a centralized infrastructure in SharePoint 2013 and Office 2013 that supports integrated data solutions.
    Business Connectivity Service will provide a familiar user interface to manage sql table data. It is more security for reading and writing data to external sql table.
    Here is a detailed article for your reference:
    https://technet.microsoft.com/en-us/library/ee661740(v=office.15).aspx
    https://msdn.microsoft.com/en-us/library/office/ee556440(v=office.14).aspx
    Best Regards
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jerry Guo
    TechNet Community Support

  • Deleting/Updating records from an object table in PL/SQL

    Hello All,
    VER:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    I have created an object and inserted records in it. Is there any way we can delete/update records from it. I do not want to delete based on iteration like delete.collection but I would like to know if we can delete directly from obj like delete from table...
    CREATE OR REPLACE TYPE test_type AS OBJECT
    col1 number,
    col2 varchar2(100)
    CREATE OR REPLACE TYPE tab_type is table of test_type;
    DECLARE
    test_tab tab_type;
    l_cnt NUMBER;
    BEGIN
    select test_type(col1,col2) bulk collect
    into test_tab from (select 1 as col1,'test1' as col2 from dual
                        union all
                        select 2,'test2' from dual);
    IF test_tab.count>0
    THEN
    DELETE FROM TABLE(CAST(test_tab as tab_type)) a
    where a.col1=1;
    END IF;
    l_cnt := test_tab.count;
    END;Thx
    Shank.

    SB,
    I have a scenario wherein I insert few records into a collection table. I'm gonna filter few records from collection table based on the filter.
    I want to delete the records that didn't match the filter. Right now, I'm inserting the records into a physical table and deleting from there. I do no want to use a physical table. Trying to avoid it.
    Would like to delete from collection itself.
    DELETE FROM TABLE(CAST(lv_attr_filter_tab as EDMS_CSPP_DISC_REQ_TAB_TYPE))
                                 WHERE NOT EXISTS (SELECT 1
                                       FROM edms_disc_lines_stg edls
                                       WHERE edls.req_id = edrg.request_id
                                          AND edls.disc_line_id = edrg.discount_id
                                          AND UPPER(edls.disc_status) IN ('ACTIVE');

  • Access is not inserting, updating or deleting records in my database table on the server

    I am having a problem with an application I developed using Dreamweaver 8 and Access 2000 several years ago which is no longer working correctly. The problem is that Access is not inserting, updating or deleting records in my database table on the server but is reflected in changes to my Web site. I used the Dreamweaver server behaviors: insert record, update record and delete record to make the changes to my Access table on the server. My Access table on the server shows all of the records I inserted or updated in the past, but not any of the newly inserted on updated records.
    does any one have any ideas as to what my problem is?
    Jim

    No, that has nothing to do with your problem. Let's make sure I understand the symptoms.
    1) Your site is online at a remote host.
    2) You use a dynamic page in your online site to update a database record (insert, delete, or update)
    3) The update then appears correctly on your dynamic content page.
    4) You download the mdb and it appears to not have any of the upates you just made.
    Please correct any of these statements if they are wrong.
    If the above is correct, then you must be looking at a cached mdb, or the mdb you are looking at is in the wrong location. Do this: search your entire drive for copies of the mdb, including in the Windows temp directories which is likely where the cached copy is located. Delete any extra copies and download again.

  • Programmatic updating multiple records of a table in ADF

    Hi,
    I am using Jdeveloper : 10g 10.1.3.3
    Problem : I need to update multiple records in DB using ADF feature.
    The senario is like user is shown records of item consisting of item name, item code, category code, price etc. then user clicks "change category code" link availabe against each record. In next page user is shown current code and provided a text box to enter new code. Once i get this in my bean i need to update all records as:
    update item_info set category_code = :new_code where category_code = :current_code. Means to udate category code in all the records where category_code is :current_code.
    I have Entity and View Object for this table.
    How do i update multiple records using created view which is entity based?
    Have A Nice Time!
    Regards,
    Kevin

    In ADF you don't use update statement directly. This is done by the framework.
    You have to search for the records which match your condition category_code = :current_code using your VO based on the entity.
    Then iterate over the result set and change each row to your need setCategoryCode(newCode);
    When you commit the changes they are persist them in the DB.
    To see the changes in the UI you have to update the display using PPR or execute the query again.
    Timo

  • Refresh af: table to fetch updated/additional records from db

    Hi,
    I have a jspx page having Create New Employee form and a table showing all the Employee records. I am using ADF Faces+Session Beans(EJB3.0)+JPA.
    The create record form is not created from data control, but using adf input text boxes and binding them manually to backing bean properties, and on save button action, calling a session facade remote method, which inturn calls the persistEntity() of JPA. This is working fine.
    The table is bound to data control , showing FindAll query results. This is also working fine.
    The problem is,for example if i have 5 employee records in db, the table will show 5 records and then I create an employee record and click on save button, then i fire a sql query on db to 'select *' , it shows that record in db, but the table(on the same page) still shows 5 records. Table doesn't show the new record that I just created, even if I refresh the page.
    So, in this case PPR and refreshing the iterator which shows the table, don't work. I even tried to invoke the method which fires FindAll query, again on save button click.But, that too, din't work. What is the solution?
    Note: I am using JDev11g.

    Hi,
    Can you brief me how you are adding the records. Like ... on click of add button opening a inline pop up and is it through that???
    Try to do the following from your backing bean.
    Solution#
    ======
    Use returnlistener of the button/action link, which you are using to open the popup.
    Here is the action how the add/edit inline popup is getting opened.
    <af:commandImageLink action="editHistory"
    immediate="true" id="clEdit"
    visible="#{row.editable and (pageFlowScope.borrowerHistoryMB.userId eq row.sourceId)}"
    shortDesc="Click to edit this comment."
    icon="/images/edit.png"
    useWindow="true" windowHeight="300"
    windowWidth="500"
    *returnListener="#{pageFlowScope.borrowerHistoryMB.refreshTableData}"* >
    Code that needs to be added inside a managed bean.
    =================================
    public void refreshTableData(ReturnEvent returnEvent) {
    AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
    adfFacesContext.addPartialTarget(getHistoryTable());
    Let me know if you have issue with any of these.
    Thanks & Regards,
    Kiran Konjeti

Maybe you are looking for

  • How can I convert this small pl/sql block in a single query?

    Hello, I need to have a single SQL query which gives the same output as the following piece of code, which uses a cursor to iterate on the rows in order to get the informations I need: declare cursor c(p varchar2) is select context_id, id, parent_id

  • Restore problems w/ iPod Classic in Windows Vista

    Hello everyone, I'm having something of a cyclical problem with my 160GB iPod Classic. The iPod has stopped working and displays the message "use Windows to restore" when I turn it on. When I connect the iPod to my computer to attempt the restore, I

  • Convert WMV and MPG to play on Mac

    Hi all, New to the Mac so probably a simple question. I have two videos on my Mac that came across from my old PC. One is in WMV format, the other is MPG. Neither are able to be played. The WMV file shows as a blank page icon while the MPG file shows

  • Can PC send/receive texts/calls via iPhone 5?

    My iPhone 5 has poor reception where my computer is located.  Can I leave the iPhone elsewhere in the house where there is better reception and send/receive texts and calls remotely via my (Win 7) PC?  If so, how? Thanks, Ron

  • Vb6 Expiring Date

    please am doing my project and i need some help in vb6 i need sql statement that will list all product that will expire within 60days based on their expiring date. this is my code, kindl help me Adodc6.RecordSource = "Select * from tblproduct where E