自增? 需要写在触发器里吧? 改成存储过程就能返回了,但是不能直接写SQL了.

解决方案 »

  1.   

    搞错概念,我的意思是说,insert一条记录之后,能否返回序列值?
    如:
    Create table tablename
    ( no number(10),
    name varchar2(12));Create sequence id_seq
    start with 1
    increment by 1;insert into tablename(no,name)
    value(id_seq.nextval,"张三");insert语句之后能否返回序列?
      

  2.   

    oracle中一般都先取,下面是个例子,要先建立个序列
    create or replace trigger tr_xcsg_bh
      before insert on xcsg  
      for each row
    declare
      -- local variables here
      newbh number;
    begin
      select xcsg_id.nextval into newbh from dual;
      :new.bh := newbh;
    end tr_xcsg_bh;