Friday, January 24, 2014

Predicate N = N-1 returns rows?

Following a tweet from  "Quiz Q for the day: "select * from T where N = N - 1;" returns rows - how?", I did a small setup to try to answer the question.

SQL> select banner from v$version where rownum=1;

Oracle Database 11g Enterprise Edition Release - 64bit Production


SQL> drop table tt
  2  ;

Table dropped.

SQL> create table tt as select 1/0f N from dual;

Table created.

SQL> desc tt;
 Name                                      Null?    Type
 ----------------------------------------- -------- -------------
 N                                                  BINARY_FLOAT

SQL> select * from tt where N=N-1;



No comments:

Post a Comment