You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Corrected "MERGE INTO" parsing for more complicated statements.
Specifically:
* Changed "Condition" to "Expression" for the "ON" clause -- this is
needed to handle "ON" clauses that have "a = y AND b = z" or other
more complicated expressions (basically the same as the "ON" clause
in a SELECT query).
* Also changed the "WHERE" and "DELETE WHERE" clauses in the same
fashion ('Condition' becomes 'Expression'), as they too support
multiple conditions.
* Corrected the toString on the MergeUpdate clause, which was missing a
comma between the fields.
* Added a new, more complicated MERGE INTO statement to the MergeTest
class.
+ " COALESCE(CASE pd.IsDeduction WHEN 1 THEN NULL ELSE ConvertedCalculatedValue END, 0) NetPrice ,\n"
79
+
+ " COALESCE(CASE pd.IsDeduction WHEN 1 THEN ConvertedCalculatedValue ELSE NULL END, 0) NetDeductionPrice ,\n"
80
+
+ " pd.QualityIndicator ,\n"
81
+
+ " row_number() OVER (PARTITION BY pd.TheMonth , pd.IdentifyingKey ORDER BY COALESCE(pd.QualityMonth, to_date('18991230', 'yyyymmdd')) DESC ) RowNumberMain ,\n"
+ " COALESCE(CASE pd.IsDeduction WHEN 1 THEN NULL ELSE ConvertedCalculatedValue END, 0) NetPrice ,\n"
92
+
+ " COALESCE(CASE pd.IsDeduction WHEN 1 THEN ConvertedCalculatedValue ELSE NULL END, 0) NetDeductionPrice ,\n"
93
+
+ " pd.QualityIndicator ,\n"
94
+
+ " NULL RowNumberMain ,\n"
95
+
+ " row_number() OVER (PARTITION BY pd.TheMonth , pd.IdentifyingKey ORDER BY COALESCE(pd.QualityMonth, to_date('18991230', 'yyyymmdd')) DESC ) RowNumberDeduction \n"
96
+
+ " FROM PricingData pd\n"
97
+
+ " WHERE pd.ThingsKey IN (:ThingsKeys)\n"
98
+
+ " AND pd.TheMonth >= :startdate\n"
99
+
+ " AND pd.TheMonth <= :enddate\n"
100
+
+ " AND pd.IsDeduction <> 0\n"
101
+
+ " )\n"
102
+
+ "GROUP BY TheMonth ,\n"
103
+
+ " IdentifyingKey\n"
104
+
+ ") Data ON ( Dest.TheMonth = Data.TheMonth \n"
105
+
+ " AND COALESCE(Dest.IdentifyingKey,0) = Data.IdentifyingKey )\n"
106
+
+ "WHEN MATCHED THEN\n"
107
+
+ " UPDATE\n"
108
+
+ " SET NetPrice = ROUND(Data.NetPrice, PriceDecimalScale) ,\n"
0 commit comments