Oracle特殊语句

 

1.字母数字检查

select content ,nvl2(translate(substr(content,1,3),'\1234567890','\'),'is characters','is number') from CHAT_200702;

判断前三位是汉字还是字母
select substr(content,1,3) from CHAT_200702 where lengthb(substr(content,1,3))=2 (把2改成1就是字母了,等于2则是汉字)

2.记录定位:查询第4条

SELECT * FROM
(
     SELECT A.*, rownum r
     FROM
          (
          SELECT *
          FROM ejc
          ORDER BY recordno DESC
                    ) A
     WHERE rownum <= 4
     ) B
WHERE r >3

你可能感兴趣的:(Oracle特殊语句)