oracle语句使用经验

前端之家收集整理的这篇文章主要介绍了oracle语句使用经验前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

SELECT
FROM (SELECT A1.
,ROWNUM RN
FROM (SELECT H.*
FROM TBC_ADOWNBLK_HIST H
WHERE 1 = 1
ORDER BY adownblkid ASC) A1
WHERE ROWNUM <= 10)
WHERE RN >= 1
想排序必须按这种写法

--根据不同字典值去加‘前缀’方法一select CASEWHEN dict_code = 'YYPZ' THEN '0' || CODEELSE '1' || CODE end as code,name as namefrom MSTB_BDS_DATAwhere (dict_code = 'VOICEOTHERTYPE' or dict_code = 'YYPZ')and record_state = '1'方法二(select '0'||CODE code,NAME from MSTB_BDS_DATA d where d.dict_code='YYPZ' and record_state = '1' ) union all (select '1'||CODE code,NAME from MSTB_BDS_DATA d where d.dict_code='VOICEOTHERTYPE' and record_state = '1')

原文链接:https://www.f2er.com/oracle/206093.html

猜你在找的Oracle相关文章