Skip to content

Commit 4f8edba

Browse files
authored
fix(oracle): Allow optional format in TO_DATE (#3637)
1 parent e998308 commit 4f8edba

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

sqlglot/expressions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5765,7 +5765,7 @@ class StrPosition(Func):
57655765

57665766

57675767
class StrToDate(Func):
5768-
arg_types = {"this": True, "format": True}
5768+
arg_types = {"this": True, "format": False}
57695769

57705770

57715771
class StrToTime(Func):

tests/dialects/test_oracle.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def test_oracle(self):
4242
self.validate_identity("SELECT * FROM table_name SAMPLE (25) s")
4343
self.validate_identity("SELECT COUNT(*) * 10 FROM orders SAMPLE (10) SEED (1)")
4444
self.validate_identity("SELECT * FROM V$SESSION")
45+
self.validate_identity("SELECT TO_DATE('January 15, 1989, 11:00 A.M.')")
4546
self.validate_identity(
4647
"SELECT last_name, employee_id, manager_id, LEVEL FROM employees START WITH employee_id = 100 CONNECT BY PRIOR employee_id = manager_id ORDER SIBLINGS BY last_name"
4748
)

0 commit comments

Comments
 (0)