我创建的序列
create sequence student_no
increment by 1
start with 1
maxvalue 9999
cycle;
函数:create or replace function getstudentno
return varchar2
is
student_no varchar2(8);
year varchar2(4);
no number;
begin
select to_char(sysdate,'yyyy') into year from dual;
dbms_output.put_line(year);
return year;
end getstudentno;
/
此时可以创建,但是在begin中加入dbms_output.putline(student_no.xextval);时,就报编译错误。
我需要在函数中使用序列,应该怎样用,需要授权吗?
function oracle sequence
------解决方案--------------------
dbms_output.putline(student_no.xextval);代码错了吧nextval
------解决方案--------------------
是啊,看看是不是因为写错了吧
------解决方案--------------------
你用2013
------解决方案--------------------
序列号.nextval试试