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
+ " 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"
+ " COALESCE(CASE pd.IsDeduction WHEN 1 THEN NULL ELSE ConvertedCalculatedValue END, 0) NetPrice ,\n"
80
+
+ " COALESCE(CASE pd.IsDeduction WHEN 1 THEN ConvertedCalculatedValue ELSE NULL END, 0) NetDeductionPrice ,\n"
81
+
+ " pd.QualityIndicator ,\n"
82
+
+ " 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"
93
+
+ " COALESCE(CASE pd.IsDeduction WHEN 1 THEN ConvertedCalculatedValue ELSE NULL END, 0) NetDeductionPrice ,\n"
94
+
+ " pd.QualityIndicator ,\n"
95
+
+ " NULL RowNumberMain ,\n"
96
+
+ " row_number() OVER (PARTITION BY pd.TheMonth , pd.IdentifyingKey ORDER BY COALESCE(pd.QualityMonth, to_date('18991230', 'yyyymmdd')) DESC ) RowNumberDeduction \n"
97
+
+ " FROM PricingData pd\n"
98
+
+ " WHERE pd.ThingsKey IN (:ThingsKeys)\n"
99
+
+ " AND pd.TheMonth >= :startdate\n"
100
+
+ " AND pd.TheMonth <= :enddate\n"
101
+
+ " AND pd.IsDeduction <> 0\n"
102
+
+ " )\n"
103
+
+ "GROUP BY TheMonth ,\n"
104
+
+ " IdentifyingKey\n"
105
+
+ ") Data ON ( Dest.TheMonth = Data.TheMonth \n"
106
+
+ " AND COALESCE(Dest.IdentifyingKey,0) = Data.IdentifyingKey )\n"
107
+
+ "WHEN MATCHED THEN\n"
108
+
+ " UPDATE\n"
109
+
+ " SET NetPrice = ROUND(Data.NetPrice, PriceDecimalScale) ,\n"
assertSqlCanBeParsedAndDeparsed("MERGE INTO a USING dual ON (col3 = ? AND col1 = ? AND col2 = ?) WHEN NOT MATCHED THEN INSERT (col1, col2, col3, col4) VALUES (?, ?, ?, ?) WHEN MATCHED THEN UPDATE SET col4 = col4 + ?");
assertSqlCanBeParsedAndDeparsed("MERGE INTO a USING dual ON (col3 = ? AND col1 = ? AND col2 = ?) WHEN MATCHED THEN UPDATE SET col4 = col4 + ? WHEN NOT MATCHED THEN INSERT (col1, col2, col3, col4) VALUES (?, ?, ?, ?)");
assertSqlCanBeParsedAndDeparsed("MERGE INTO a USING dual ON (col3 = ? AND col1 = ? AND col2 = ?) WHEN MATCHED THEN UPDATE SET col4 = col4 + ? WHEN NOT MATCHED THEN INSERT (col1, col2, col3, col4) VALUES (?, ?, ?, ?) WHEN MATCHED THEN UPDATE SET col4 = col4 + ?");
0 commit comments