After Executing Mergeworkspace Or Mergetable With Remove_data => False, Query By PK Return 2 Rows (Doc ID 1375929.1)

Last updated on FEBRUARY 08, 2017

Applies to:

Workspace Manager - Version 10.2.0.4 to 11.2.0.2 [Release 10.2 to 11.2]
Information in this document applies to any platform.

Symptoms

After a DBMS_WM.MERGEWORKSPACE with remove_workspace=false, a query on the table from the child workspace returns double rows, where the table has a primary key.
For example , if the row inserted is

1  ' This is the Workspace1'

the result of the query will be

1  ' This is the Workspace1'
1  ' This is the Workspace1'



Code example

-- Create table
create table WMTEST_TABLE
(
COL_PK number not null,
DESCRIPTION varchar2(30)
);

-- Create constraints
alter table WMTEST_TABLE
add constraint WMTEST_TABLE_PK1 primary key (COL_PK);


-- Prepare environment
begin
dbms_wm.gotoworkspace('LIVE');
dbms_wm.enableversioning('WMTEST_TABLE');
dbms_wm.createworkspace(workspace => 'WorkspaceTEST1', description => 'WorkspaceTEST1', auto_commit => false, isrefreshed => true);
dbms_wm.createworkspace(workspace => 'WorkspaceTEST2', description => 'WorkspaceTEST2', auto_commit => false, isrefreshed => true);
commit;
end;
/

-- Insert row on WorkspaceTEST1
exec dbms_wm.gotoworkspace('WorkspaceTEST1');
insert into WMTEST_TABLE(COL_PK, DESCRIPTION) values(1, 'Row created on WorkspaceTEST1');
commit;

-- Insert row with same ID on WorkspaceTEST2
exec dbms_wm.gotoworkspace('WorkspaceTEST2');
insert into WMTEST_TABLE(COL_PK, DESCRIPTION) values(1, 'Row created on WorkspaceTEST2');
commit;

-- Mergeworkspace or mergetable table from WS1, with remove_data => false
exec dbms_wm.gotoworkspace('LIVE');
exec dbms_wm.mergeworkspace(workspace => 'WorkspaceTEST1');
commit;


-- On WS1, the following query, returns 2 rows, when only one is expected
exec dbms_wm.gotoworkspace('WorkspaceTEST1');
select * from WMTEST_TABLE t where t.COL_PK=1;

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms