-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Grammar or Syntax Description
- BigQuery in the "merge ... when not matched " allows to define when it's not matched by target or by source
currently jsqlparser is failing with these kind of statemnt stating UnsupportedStatement
https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement
when_clause ::= matched_clause | not_matched_by_target_clause | not_matched_by_source_clause
matched_clause ::= WHEN MATCHED [ AND search_condition ] THEN { merge_update_clause | merge_delete_clause }
not_matched_by_target_clause ::= WHEN NOT MATCHED [BY TARGET] [ AND search_condition ] THEN merge_insert_clause
not_matched_by_source_clause ::= WHEN NOT MATCHED BY SOURCE [ AND search_condition ] THEN { merge_update_clause | merge_delete_clause }
SQL Example
MERGE INTO target_table AS tt
USING ( SELECT key, field FROM source_table) AS st
ON tt.key = st.key
WHEN NOT MATCHED BY TARGET THEN
INSERT (key, field)
VALUES (st.key, st.field)
WHEN NOT MATCHED BY SOURCE THEN DELETE
;
can it be included?
thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels