
When the second select is run optimizer merges the view definition and where would adopt becomes: Reason is first selection from the first filters view (find out where clause) out of the non-numeric values and then only apply to_number.

SQL> insert into tbl values('number','123') SQL> insert into tbl values('string','abc')


Let me guess - tbl is actually a point of view: SQL> create table tbl(code varchar2(10),val varchar2(10))
