Re: [cx-oracle-users] ORA-01790 error on union all with nullable bind variables
Brought to you by:
atuining
|
From: Jani T. <re...@gm...> - 2016-04-18 08:07:00
|
In Oracle "DUAL" is just a table with column named "DUMMY" which is
VARCHAR2(1).
Treating None with proper datatype might require some additional work
(IOW, you need to state that your argument is type of varchar).
On 18.04.2016 10:31, Mikhail Nacharov wrote:
> Hello everyone!
>
> Does anybody know why this query fails with ORA-01790?
>
> ```
>>>> import cx_Oracle
>>>> con = cx_Oracle.connect('django/django@127.0.0.1/orcl')
>>>> cur = con.cursor()
>>>> cur.execute('SELECT 1 FROM dual UNION ALL SELECT :arg0 FROM dual',
> arg0=None)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> cx_Oracle.DatabaseError: ORA-01790: expression must have same datatype
> as corresponding expression
> ```
>
> It seems to me that bind variables passes as empty string '' and not as
> NULL value.
> Moreover, when I execute this query in oracle sqldeveloper I had the
> same exception. Is it some oracle "feature"?
>
> P.S.: The purpose of this question is the bug in django:
> https://code.djangoproject.com/ticket/22669
>
>
|