Update_conflict_handler

Hi everyone
I need your help..
I have a streams environment in Two Database 10gR2 on Unix.
The replication processes working, but I have a problem during execution of this procedure
DBMS_APPLY_ADM.SET_UPDATE_CONFLICT_HANDLER... I need to remove a column
from sys.apply$_conf_hdlr_columns. How to perform that ??
Thanks
Lewis

Check if you are modifying any other column as well. May be if you have LOG_ID column or something like this. Try to add all table columns in the column list.
The other way is to try to exclude columns with DBMS_APPLY_ADM.COMPARE_OLD_VALUES() procedure.
Svetoslav

Similar Messages

  • Need Help  in converting LCR to UPDATE when ORA-0001 received during apply

    Currently I have streams (one-way) set up between two sites (Site A and B).
    Data is inserted at Site A from an application. There is a possibility that the row already exists at Site B with another set of values resulting in Apply getting failed with ORA-0001 error. I have the folllowing DML_HANDLER to update the row at Site B when a row exists in Site B.
    ++++++++++++++++++++++++
    create or replace procedure dept_ora_001 ( in_any sys.anydata)
    is
    lcr sys.lcr$_row_record;
    old_val sys.lcr$_row_list;
    new_val sys.lcr$_row_list;
    rc pls_integer;
    cmd_type varchar2(100);
    v_col_deptno sys.anydata;
    v_val_deptno number ;
    v_col_lastmodified sys.anydata;
    v_val_lastmodified date;
    v_curr_val_lastmodified date;
    pExist number;
    begin
    rc := in_any.GetObject(lcr);
    cmd_type := lcr.get_command_type();
    v_col_deptno := lcr.get_value('NEW','DEPTNO');
    v_col_lastmodified := lcr.get_value('NEW','LASTMODIFIED');
    rc := v_col_deptno.getnumber(v_val_deptno);
    rc := v_col_lastmodified.getdate(v_val_lastmodified);
    if cmd_type = 'INSERT' then
    select count(*) into pExist from scott.dept where deptno = v_val_deptno;
    -- Row does not exist.. execute lcr to insert row
    if pExist = 0 then
    lcr.execute(true);
    else
    -- Row existis.. compare values of lastmodifed and change the lcr to UPDATE if New DEPT created at source.
    select lastmodified into v_curr_val_lastmodified
    from nbkl8xk.dept where deptno = v_val_deptno;
    if (v_curr_val_lastmodified is null or
    v_val_lastmodified > v_curr_val_lastmodified ) then
    lcr.set_command_type('UPDATE');
    lcr.set_values('OLD',lcr.get_values('NEW'));
    lcr.execute(true);
    end if;
    end if;
    end if;
    end;
    begin
    dbms_apply_adm.set_dml_handler
    ( object_name => 'SCOTT.DEPT',
    object_type => 'TABLE',
    operation_name => 'INSERT',
    error_handler => false,
    user_procedure => 'STRMADMIN.DEPT_ORA_001'
    end;
    ++++++++++++++++++++++++++++
    The DML handler is getting fired correctly and it is changing the LCR into UPDATE. Now, I am receiving ora-1403 (no data found). This is because the OLD values do not match with the row at Site B. ( I am setting OLD_Values to New_Values in the DML_HANDLER)
    To address this I created the following update_conflict_handler.
    ++++++++++++++++++
    declare
    v_cols dbms_utility.name_array;
    begin
    v_cols(1) := 'DEPTNO';
    v_cols(2) := 'DNAME';
    v_cols(3) := 'LOC';
    v_cols(4) := 'LASTMODIFIED';
    dbms_apply_adm.set_update_conflict_handler(
    object_name => SCOTT.DEPT',
    method_name => 'MAXIMUM',
    resolution_column => 'LASTMODIFIED',
    column_list => v_cols
    end;
    +++++++++++++++++++++
    I am not getting any 1403 errors now. However, the row at Site B is not getting updated with the values at Site A.
    Any help is appreciated.
    Thanks

    I fired the query, am not getting any output from dbms_output.put_line('..|USER_COUNTRY..');
    Is that no data is reading or may be any reason else..
    in this table store_id is the primary key ..
    SQL> set serveroutput on
    SQL> CREATE OR REPLACE PROCEDURE test(in_any sys.anydata) IS
    2 lcr sys.lcr$_row_record;
    3 rc pls_integer;
    4 v_type varchar2(20);
    5 col_1 sys.anydata;
    6 col_2 sys.anydata;
    7 lcr_usercountry varchar2(20);
    8 lcr_storeid number;
    9 TRANS varchar2(20);
    10 store_id number;
    11 USER_COUNTRY varchar2(20);
    12
    13 BEGIN
    14 rc:=in_any.GetObject(lcr);
    15 v_type:=lcr.get_command_type();
    16 col_1:=lcr.get_value('NEW','USER_COUNTRY');
    17 rc:=col_1.GetVarchar2(lcr_usercountry);
    18 col_2:=lcr.get_value('NEW','STORE_ID');
    19 rc:=col_2.getnumber(lcr_storeid);
    20 select user_country into user_country from dev03.testrep1 where user_country=lcr_usercountry and store_id=lcr_storeid;
    21 dbms_output.put_line('---------||USER_COUNTRY ||-----------');
    22 END;
    23 /
    Procedure created.
    Thanks for your help ....

Maybe you are looking for

  • Printing unicode from an xml file

    I have a unicode character in an xml file say < item name="Notification" value="hi amigo\u0041" /> When I parse this file and try to print out the String value I get the follwoing output hi amigo\u0041 Thoug what I expected was hi amigoA any idea wha

  • CRVS2010 Beta - Fit to Width WPF Viewer in code-behind

    Does anyone know if there is a method that I can use in code behind to make the report in the WPF Viewer fit to width?? I need this cause I want the report to fit to Width every time I resize my window. Thanks

  • Help: Method Error

    Hi: I trying to develop a method in a program but I keep getting the following error message: Monoalphabet.java:59: Method void encrypt() requires a method body. Otherwise declare it as abstract. public static void encrypt(); Can someone please tell

  • Personalization in iproc page

    Hi All, We have requirement to personalization the iproc page. When a requisition is created and goes for approval. And the approver wants to make any changes on the requisition he will hit link 'Edit Requisition'. The changes we want to make is to c

  • [U8.1]Globalization is not working in my windows store app

    Hi, I have a set of 20 resource files(resw) in its respective folders under strings folder in the Shared project of my Universal App. When I change the system's primary language, appropriate language file is not getting picked up , instead it always