INTERVAL(N,N1,N2,N3,..........)
INTERVAL()函数将N个列表(N1,N2,N3,等等)的值进行比较。该函数返回0如果N<N1,1如果N<N2,2如果N<N 3,依此类推。它会返回1,如果N为NULL。值列表必须是N1<N2<N3形式才能正常工作。下面的代码是演示INTERVAL()函数的工作原理,一个简单的例子:
SQL>SELECT INTERVAL(6,1,2,3,4,5,6,7,8,9,10); +---------------------------------------------------------+ | INTERVAL(6,1,2,3,4,5,6,7,8,9,10) | +---------------------------------------------------------+ | 6 | +---------------------------------------------------------+ 1 row in set (0.00 sec)