public String getPlanSQL() { StatementBuilder buff = new StatementBuilder("MERGE INTO "); buff.append(table.getSQL()).append('('); for (Column c : columns) { buff.appendExceptFirst(", "); buff.append(c.getSQL()); } buff.append(')'); if (keys != null) { buff.append(" KEY("); buff.resetCount(); for (Column c : keys) { buff.appendExceptFirst(", "); buff.append(c.getSQL()); } buff.append(')'); } buff.append('\n'); if (list.size() > 0) { buff.append("VALUES "); int row = 0; for (Expression[] expr : list) { if (row++ > 0) { buff.append(", "); } buff.append('('); buff.resetCount(); for (Expression e : expr) { buff.appendExceptFirst(", "); if (e == null) { buff.append("DEFAULT"); } else { buff.append(e.getSQL()); } } buff.append(')'); } } else { buff.append(query.getPlanSQL()); } return buff.toString(); }