void appendMatchedClause(StringBuilder sb) {
        sb.append("WHEN MATCHED THEN ");
        sb.append("UPDATE ");
        sb.append("SET ");
        List<String> pkList = jdbcTable.getPrimaryKeyList();
        Iterator<String> it = jdbcTable.dbFieldNames().iterator();
        boolean needsDelimiter = false;
        while (it.hasNext()) {
            String dbFieldName = it.next();
            // Oracle doesn't allow updating the values referenced in the ON clause i.e. the primary keys
            // Skip the primary keys.
            if (pkList.contains(dbFieldName)) {
                continue;
            }
            if (needsDelimiter) {
                sb.append(", ");
            }
            sb.append("TARGET.");
            dialect.quoteIdentifier(sb, dbFieldName);
            sb.append(" = SOURCE.");
            dialect.quoteIdentifier(sb, dbFieldName);
            needsDelimiter = true;
        }
        sb.append(" WHEN NOT MATCHED THEN INSERT ");
        appendFieldNames(sb, jdbcTable.dbFieldNames());
        sb.append(" VALUES");
        appendSourceFieldNames(sb, jdbcTable.dbFieldNames());
    }
@Test
    public void appendMatchedClause() {
        OracleUpsertQueryBuilder builder = new OracleUpsertQueryBuilder(jdbcTable, dialect);
        StringBuilder sb = new StringBuilder();
        builder.appendMatchedClause(sb);

        String matchedClause = sb.toString();
        assertThat(matchedClause).isEqualTo(
                "WHEN MATCHED THEN "
                        + "UPDATE SET "
                        + "TARGET.\"field1\" = SOURCE.\"field1\", "
                        + "TARGET.\"field2\" = SOURCE.\"field2\" "
                        + "WHEN NOT MATCHED THEN "
                        + "INSERT (\"field1\", \"field2\") VALUES(SOURCE.\"field1\", SOURCE.\"field2\")"
        );
    }