随笔分类 -  oracle

摘要:--建立自增序列create sequence seqidNOMAXvaluestart with 1increment by 1nocacheorder;--建立触发器create or replace trigger tri_test_id before insert on mytable --mytable为要插入自增序列的表 for each rowdeclare nextid number;begin IF :new.Id IS NULL or :new.Id=0 THEN --id是要插入自增序列的列名 select seqid.nextval int... 阅读全文
posted @ 2013-03-12 16:19 panlovestan 阅读(143) 评论(0) 推荐(0)
摘要:用数据说话:同样的环境下测试4次//省时分页select * from(select a.*,rownum rn from (select * from cfma_dms_report) a where rownum<40) where rn>20 耗时:22.4 27.3 22.0 23.2//耗时分select * from(select a.*,rownum rn from (select * from cfma_dms_report) a ) where rn between 20 and 40 耗时: 36.09 27.25 28.3 32.1 阅读全文
posted @ 2013-03-06 16:21 panlovestan 阅读(122) 评论(0) 推荐(0)