diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py
index d749173..46ad9dc 100644
a
|
b
|
class BaseDatabaseFeatures(object):
|
68 | 68 | # by returning the type used to store duration field? |
69 | 69 | supports_temporal_subtraction = False |
70 | 70 | |
71 | | # Does the database driver support timedeltas as arguments? |
72 | | # This is only relevant when there is a native duration field. |
73 | | # Specifically, there is a bug with cx_Oracle: |
74 | | # https://bitbucket.org/anthony_tuininga/cx_oracle/issue/7/ |
75 | | driver_supports_timedelta_args = False |
76 | | |
77 | 71 | # Do time/datetime fields have microsecond precision? |
78 | 72 | supports_microsecond_precision = True |
79 | 73 | |
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index 2e6f02c..dd60cc6 100644
a
|
b
|
class OracleParam(object):
|
344 | 344 | param = param.astimezone(timezone.utc).replace(tzinfo=None) |
345 | 345 | param = Oracle_datetime.from_datetime(param) |
346 | 346 | |
347 | | if isinstance(param, datetime.timedelta): |
348 | | param = duration_string(param) |
349 | | if ' ' not in param: |
350 | | param = '0 ' + param |
351 | | |
352 | 347 | string_size = 0 |
353 | 348 | # Oracle doesn't recognize True and False correctly in Python 3. |
354 | 349 | # The conversion done below works both in 2 and 3. |
diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py
index b800339..0d235ff 100644
a
|
b
|
WHEN (new.%(col_name)s IS NULL)
|
97 | 97 | """ |
98 | 98 | return "NUMTODSINTERVAL(%06f, 'SECOND')" % (timedelta.total_seconds()), [] |
99 | 99 | |
| 100 | def format_for_duration_arithmetic(self, sql): |
| 101 | return "NUMTODSINTERVAL(%s / 1000000, 'SECOND')" % sql |
| 102 | |
100 | 103 | def date_trunc_sql(self, lookup_type, field_name): |
101 | 104 | # http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions230.htm#i1002084 |
102 | 105 | if lookup_type in ('year', 'month'): |
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py
index 5c137ed..3add089 100644
a
|
b
|
class Value(Expression):
|
600 | 600 | class DurationValue(Value): |
601 | 601 | def as_sql(self, compiler, connection): |
602 | 602 | connection.ops.check_expression_support(self) |
603 | | if (connection.features.has_native_duration_field and |
604 | | connection.features.driver_supports_timedelta_args): |
| 603 | if connection.features.has_native_duration_field: |
605 | 604 | return super(DurationValue, self).as_sql(compiler, connection) |
606 | 605 | return connection.ops.date_interval_sql(self.value) |
607 | 606 | |