先创建一个sequence
CREATE SEQUENCE test_sequence
INCREMENT BY 1 -- 每次加几个
START WITH 1 -- 从1开始计数
NOMAXVALUE -- 不设置最大值
NOCYCLE -- 一直累加,不循环
CACHE 10;
然后select test_sequence.nextval, * from A where 条件;
CREATE SEQUENCE test_sequence
INCREMENT BY 1 -- 每次加几个
START WITH 1 -- 从1开始计数
NOMAXVALUE -- 不设置最大值
NOCYCLE -- 一直累加,不循环
CACHE 10;
然后select test_sequence.nextval, * from A where 条件;
是要这样吗?
select rownum ,t.* from t;
is OK
---------- ---------- ----------
1 000001 2
2 000002 2
3 000003 4Executed in 0.015 secondsSQL>
别给我分啊!