字段barcode:SD001P0000001 一直到 SD0001P9999999,循环0000001~~~9999999
SD001P0000001
SD001P0000002
SD001P0000003
SD001P0000004
SD001P0000005
SD001P0000006
SD001P0000007
~~~~~~~~~~
~~~~~~~~~~
SD001P9999999select barcode as 条码,singleprice as 单价,bindinfo as 装帧信息,totalprice as 套价 
from holding
where barcode>=SD001P0000001 and barcode<=SD001P9999999
该SQL报错,请各位大侠帮手修改修改。

解决方案 »

  1.   


    select barcode as 条码,singleprice as 单价,bindinfo as 装帧信息,totalprice as 套价  
    from holding
    where to_number(substr(barcode,7,length(barcode)))>=to_number(0000001) and to_number(substr(barcode,7,length(barcode)))<=to_number(9999999)
      

  2.   


    select barcode as 条码,singleprice as 单价,bindinfo as 装帧信息,totalprice as 套价  
    from holding
    where barcode>='SD001P0000001' and barcode<='SD001P9999999'
      

  3.   

    报错是肯定的,原因是 barcode在你定义表的时候肯定定义的不是int之类的类型,不能用>,前面两楼的都给你解决了!