Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sqlglot/dialects/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Oracle(Dialect):
"HH12": "%I", # alias for HH
"HH24": "%H", # Hour of day (0-23)
"IW": "%V", # Calendar week of year (1-52 or 1-53), as defined by the ISO 8601 standard
"IYYY": "%G", # 4-digit year of the ISO 8601 week-numbering calendar
"MI": "%M", # Minute (0-59)
"MM": "%m", # Month (01-12; January = 01)
"MON": "%b", # Abbreviated name of month
Expand Down
12 changes: 12 additions & 0 deletions tests/dialects/test_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,18 @@ def test_oracle(self):
"postgres": "CAST('2022-01-01' AS DATE)",
},
)
self.validate_all(
"SELECT TO_CHAR(x, 'IYYY-IW')",
read={
"duckdb": "SELECT STRFTIME(x, '%G-%V')",
},
)
self.validate_all(
"SELECT TO_CHAR(CAST(x AS DATE), 'IYYY-IW')",
read={
"bigquery": "SELECT FORMAT_DATE('%G-%V', x)",
},
)

self.validate_all(
"x::binary_double",
Expand Down
Loading