Class Merge

    • Constructor Detail

      • Merge

        public Merge​(String destinationTable)
        Create a new instance of a Merge.
        Parameters:
        destinationTable - table into which the data should be merged
      • Merge

        public Merge​(String destinationTable,
                     String alias)
        Create a new instance of a Merge.
        Parameters:
        destinationTable - table into which the data should be merged
        alias - table alias
    • Method Detail

      • using

        public Merge using​(String sourceTable)
        Define the data source.
        Parameters:
        sourceTable - table where the data to be merged originates
        Returns:
        this for fluent programming
      • using

        public Merge using​(String sourceTable,
                           String as)
        Define the data source.
        Parameters:
        sourceTable - table where the data to be merged originates
        as - table alias
        Returns:
        this for fluent programming
      • getUsing

        public UsingClause getUsing()
        Get the USING clause of the MERGE statement.
        Returns:
        destination table
      • hasUsing

        protected boolean hasUsing()
        Check if the USING clause exists.
        Returns:
        true if the USING clause 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:
        this for 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 the ON clause exists.
        Returns:
        true if the ON clause exists.
      • whenMatched

        public MatchedClause whenMatched()
        Define the merge strategy if the match criteria is met.
        Returns:
        match strategy
      • hasMatched

        protected boolean hasMatched()
        Check if the WHEN MATCHED clause exists.
        Returns:
        true if the WHEN MATCHED clause exists
      • getMatched

        public MatchedClause getMatched()
        Get the WHEN MATCHED clause.
        Returns:
        WHEN MATCHED clause
      • 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 the WHEN NOT MATCHED clause exists.
        Returns:
        true if the WHEN NOT MATCHED clause exists
      • getNotMatched

        public MatchedClause getNotMatched()
        Get the WHEN NOT MATCHED clause.
        Returns:
        WHEN NOT MATCHED clause
      • accept

        public void accept​(MergeVisitor visitor)
        Description copied from interface: MergeFragment
        Accept a visitor (e.g. a renderer or validator).
        Specified by:
        accept in interface MergeFragment
        Parameters:
        visitor - visitor to accept