Purpose
Applies changes to a table (all rows or as specified in the Where clause) in a workspace to its parent workspace in the database (Oracle 9i or later). You can issue this statement from the MapBasic window in MapInfo Pro.
Syntax
Server Workspace Merge
Table TableName
[ Where WhereClause ]
[ RemoveData { OFF | ON } ]
[ { Interactive | Automatic merge_keyword } ]
TableName is the name (alias) of an open MapInfo table from an Oracle9i or later server. The table contains rows to be merged into its parent workspace.
WhereClause is a string that identifies the rows to be merged into the parent workspace.
merge_keyword is a keyword(s) that limit the Automatic merge behavior.
Description
This statement only applies to Oracle9i or later. All data that satisfies the WhereClause in TableName is applied to the parent workspace. Any locks that are held by rows being merged are released. If there are conflicts between the workspace being merged and its parent workspace, this operation provides user options on how to solve the conflict. The merge operation was executed only after all the conflicts were resolved. A table cannot be merged in the LIVE workspace (because that workspace has no parent workspace). A table cannot be merged or refreshed if there is an open database transaction affecting the table.
Refer to Oracle9i Application Developer's Guide - Workspace Manager for more information.
WhereClause identifies the rows to be merged into the parent workspace. The clause itself should omit the Where keyword. for example, 'MI_PRINX = 20'. Only primary key columns can be specified in the Where clause. The Where clause cannot contain a subquery. If WhereClause is not specified, all rows in TableName are merged.
If RemoveData is set ON, the data in the table (as specified by WhereClause) in the child workspace will be removed. This option is permitted only if workspace has no child workspaces (that is, it is a leaf workspace). OFF (the default) does not remove the data in the table in the child workspace.
If there are conflicts between the workspace being merged and its parent workspace, the user must resolve conflicts first in order for merging to succeed. MapInfo Pro allows the user to resolve the conflicts first and then to perform the merging within the process. The Interactive and Automatic clauses let you control what happens when there is a conflict. These clauses have no effect if there is no conflict between the workspace being merged and its parent workspace.
If the Interactive clause is specified, MapInfo Pro displays the Conflict Resolution dialog box in the event of a merge conflict. The conflicts will be resolved one by one or all together based on user choices. After all the conflicts are resolved, the table is merged into its parent based on the user's choices.
The following table shows the possible values for merge_keyword used with the Automatic setting.
merge_keyword value | Description |
---|---|
StopOnConflict | In the event of a conflict, MapInfo Pro will stop here. (This is also the default behavior if the statement does not include an Interactive clause or an Automatic clause.) |
RevertToBase | In the event of a conflict, MapInfo Pro reverts to the original (base) values. (it causes the base rows to be copied to the child workspace but not to the parent workspace. However, the conflict is considered resolved; and when the child workspace is merged, the base rows are copied to the parent workspace too.) Note that BASE is ignored for insert―insert conflicts where a base row does not exist; in this case the Automatic clause must include UseParent or UseCurrent.) |
UseCurrent | In the event of a conflict, MapInfo Pro uses the child workspace values. |
UseParent | In the event of a conflict, MapInfo Pro uses the parent workspace values. |
Examples
The following example merges changes to the GWMUSA2 table where MI_PRINX=60 in MIUSER to its parent workspace.
Server Workspace Merge
Table "GWMUSA2"
Where "MI_PRINX = 60"
Automatic UseCurrent
See Also:
Server Workspace Refresh statement