More on ORA-01722

From: vsevolod afanassiev <vsevolod.afanassiev_at_gmail.com>
Date: Thu, 14 Mar 2013 13:55:56 -0700 (PDT)
Message-ID: <ba0cce16-f53c-467d-aaf6-78c30ec77b8a_at_googlegroups.com>



Simple test:

SQL> create table test1722(v varchar2(20));

Table created.

SQL> insert into test1722 values ('1');

1 row created.

SQL> insert into test1722 values ('b');

1 row created.

SQL> select * from test1722 where v = 1; ERROR:
ORA-01722: invalid number

It appears that Oracle converts query into:

SQL> select * from test1722 where to_number(v) = 1; ERROR:
ORA-01722: invalid number

Why? One would expect it to do the opposite:

SQL> select * from test1722 where v = to_char(1);

V



1 Received on Thu Mar 14 2013 - 21:55:56 CET

Original text of this message