参考文献:http://chengjunflying.iteye.com/blog/698505

在oracle中,如果要对varchar类型的字段进行order by操作,那么首先必须得将他们转化成数字类型,比如int类型,这就需要用到cast关键字。

例子

SELECT  procedure_no  FROM (SELECT  *  FROM process_card_procedure where process_card_id=421 order by cast(procedure_no as int) desc) where rownum<=1 cast(procedure_no as int) 

上述SQL语句中的就是将procedure_no转化成了int类型在进行order by操作。

相关文章:

  • 2021-10-18
  • 2021-12-21
  • 2022-12-23
  • 2021-08-17
  • 2022-12-23
  • 2021-08-08
  • 2021-07-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2021-11-18
相关资源
相似解决方案