select * from yourtable 
where col1 between floor(val/10)*10 and ceil(val/10)*10val 就是16或23

解决方案 »

  1.   

    select max(col1) from tab where col1<val
    union
    select min(col1) from tab where col1>val;
      

  2.   

    to: more_zou(小人物) 
     你的SQL最多只能取到两列,如果有第三列满足要求呢? -)
      

  3.   

    谢谢 Lastdrop(空杯):不过,col1是任意的数字型col1    col2    col3
    1.15       abc    def
    1.20       hij    dea
    1.25       haha   jiji输入1.18 或 1.21 就不对啦。
      

  4.   

    利用分折函数,试一试吧,还没直正测试过.
    select * from table_name where col1 in (select col from (select col1,lead(col1,1,null) over(order by col1) next_col1 from table_name order by col1) where decode(sign(col1-值)+sign(next_col1-值),0,1)=0 and rownum<3)
      

  5.   

    我有点误解了你的问题,那你还是用 more_zou(小人物) 的SQL吧,不过用union all效率高一点,因为两个集合不可能有重复项的。select max(col1) from tab where col1<val
    union all
    select min(col1) from tab where col1>val;