-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add parsing support for
MERGE
statement
- Loading branch information
1 parent
2935faf
commit 10068c7
Showing
5 changed files
with
488 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.txt text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- Merge using Table | ||
MERGE INTO t USING u ON (a = b) | ||
WHEN MATCHED THEN | ||
UPDATE SET a = b | ||
WHEN NOT MATCHED THEN | ||
INSERT (b) VALUES (c); | ||
|
||
-- Merge using Select | ||
MERGE INTO t USING (SELECT * FROM u) AS u ON (a = b) | ||
WHEN MATCHED THEN | ||
UPDATE SET a = b | ||
WHEN NOT MATCHED THEN | ||
INSERT (b) VALUES (c); | ||
|
||
-- Merge using Delete | ||
MERGE INTO t USING u ON (a = b) | ||
WHEN MATCHED THEN | ||
UPDATE SET a = b | ||
WHEN MATCHED THEN DELETE; | ||
|
||
-- Merge using multiple operations | ||
MERGE INTO t USING u ON (a = b) | ||
WHEN MATCHED AND a > b THEN | ||
UPDATE SET a = b | ||
WHEN MATCHED AND ( a < b AND c < d ) THEN DELETE | ||
WHEN NOT MATCHED THEN INSERT (a, c) VALUES (b, d); |
Oops, something went wrong.