Package com.exasol.sql.dml.merge
Class Merge
- java.lang.Object
-
- com.exasol.sql.AbstractFragment
-
- com.exasol.sql.dml.merge.Merge
-
- All Implemented Interfaces:
MergeFragment,Fragment,SqlStatement
public class Merge extends AbstractFragment implements SqlStatement, MergeFragment
-
-
Field Summary
-
Fields inherited from class com.exasol.sql.AbstractFragment
root
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(MergeVisitor visitor)Accept a visitor (e.g.MatchedClausegetMatched()Get theWHEN MATCHEDclause.MatchedClausegetNotMatched()Get theWHEN NOT MATCHEDclause.OnClausegetOn()Get the merge criteria (i.e.UsingClausegetUsing()Get theUSINGclause of theMERGEstatement.protected booleanhasMatched()Check if theWHEN MATCHEDclause exists.protected booleanhasNotMatched()Check if theWHEN NOT MATCHEDclause exists.protected booleanhasOn()Check if theONclause exists.protected booleanhasUsing()Check if theUSINGclause exists.Mergeon(BooleanExpression condition)Define the merge criteria.Mergeusing(String sourceTable)Define the data source.Mergeusing(String sourceTable, String as)Define the data source.MatchedClausewhenMatched()Define the merge strategy if the match criteria is met.NotMatchedClausewhenNotMatched()Define the merge strategy if the match criteria is not met.-
Methods inherited from class com.exasol.sql.AbstractFragment
getRoot
-
-
-
-
Method Detail
-
using
public Merge using(String sourceTable)
Define the data source.- Parameters:
sourceTable- table where the data to be merged originates- Returns:
thisfor fluent programming
-
using
public Merge using(String sourceTable, String as)
Define the data source.- Parameters:
sourceTable- table where the data to be merged originatesas- table alias- Returns:
thisfor fluent programming
-
getUsing
public UsingClause getUsing()
Get theUSINGclause of theMERGEstatement.- Returns:
- destination table
-
hasUsing
protected boolean hasUsing()
Check if theUSINGclause exists.- Returns:
trueif theUSINGclause exists.
-
on
public Merge on(BooleanExpression condition)
Define the merge criteria.- Parameters:
condition- criteria that must be met for the rows in source and destination to be considered a match.- Returns:
thisfor fluent programming
-
getOn
public OnClause getOn()
Get the merge criteria (i.e. the `ON` clause).- Returns:
- criteria that must be met for the rows in source and destination to be considered a match.
-
hasOn
protected boolean hasOn()
Check if theONclause exists.- Returns:
trueif theONclause exists.
-
whenMatched
public MatchedClause whenMatched()
Define the merge strategy if the match criteria is met.- Returns:
- match strategy
-
hasMatched
protected boolean hasMatched()
Check if theWHEN MATCHEDclause exists.- Returns:
trueif theWHEN MATCHEDclause exists
-
getMatched
public MatchedClause getMatched()
Get theWHEN MATCHEDclause.- Returns:
WHEN MATCHEDclause
-
whenNotMatched
public NotMatchedClause whenNotMatched()
Define the merge strategy if the match criteria is not met.- Returns:
- not matched strategy
-
hasNotMatched
protected boolean hasNotMatched()
Check if theWHEN NOT MATCHEDclause exists.- Returns:
- true if the
WHEN NOT MATCHEDclause exists
-
getNotMatched
public MatchedClause getNotMatched()
Get theWHEN NOT MATCHEDclause.- Returns:
WHEN NOT MATCHEDclause
-
accept
public void accept(MergeVisitor visitor)
Description copied from interface:MergeFragmentAccept a visitor (e.g. a renderer or validator).- Specified by:
acceptin interfaceMergeFragment- Parameters:
visitor- visitor to accept
-
-