日期:2014-05-17  浏览次数:20822 次

oracle自增列问题 求高手解答
一张表的主键 ,怎么设置可以让它的值为00-99之间 其中10以前的数为 01,02,03,04......

------解决方案--------------------
SQL code
scott@ORA11GR2> create sequence seq minvalue 1 maxvalue 100;

Sequence created.

scott@ORA11GR2> select to_char(seq.nextval-1, '09') from dual;

TO_
---
 00

scott@ORA11GR2> select to_char(seq.nextval-1, '09') from dual;

TO_
---
 01

scott@ORA11GR2> select to_char(seq.nextval-1, '09') from dual;

TO_
---
 02