我创建了一个像这样的序列和函数
SQL> create sequence dushy
2 maxvalue 150
3 start with 99
4 increment by 1
5 cache 5;
SQL> create or replace function ddr(z number)
2 return number is val number;
3 begin
4 if z=0 then return (val);
5 end if;
6 dbms_output.put_line(ddr(z-1));
7 update pls set rno=dushy.nextval;
8 return(val);
9 end;
10 /
我有一张这样的表
SQL> select * from pls;
RNO NAME
---------- ----------
dushy
sudha
jokin
ravi
dhanesh
我使用此查询来更新此表
SQL> set serveroutput on;
SQL>
SQL> declare
2 n number;
3 begin
4 n:=&n;
5 dbms_output.put_line(ddr(n));
6 end;
7 /
Enter value for n: 5
old 4: n:=&n;
new 4: n:=5;
PL/SQL procedure successfully completed.
但结果是这样的......
SQL> select * from pls;
RNO NAME
---------- ----------
120 dushy
121 sudha
122 jokin
123 ravi
124 dhanesh
我需要RNO为101,102,103 ..就像这样......如何解决这个问题? 提前谢谢你