而我不用块,直接从dual中取值是没问题的
SQL> select   price_his_key.nextval  from dual;   NEXTVAL
----------
         5

解决方案 »

  1.   

    SQL> create sequence price_his_key
      2  start with 1
      3  increment by 1
      4  nocycle;序列已创建。SQL> set serverout on
    SQL> declare
      2   log_seq_num integer;
      3  begin
      4   select price_his_key.nextval into log_seq_num from dual;
      5   dbms_output.put_line(log_seq_num);
      6  end;
      7  /
    1PL/SQL 过程已成功完成。应该没问题的
      

  2.   

    看看你dual表里有几条数据? 如果不是1条的话必然出错
      

  3.   

    select * from dual;
    看看是否dual 表有问题.
      

  4.   

    和有钱的日子的操作一墨一样SQL> drop sequence price_his_key
      2  /序列已丢弃。SQL> create sequence price_his_key
      2     start with 1
      3     increment by 1
      4    nocycle;序列已创建。SQL>
    SQL> declare
      2      log_seq_num integer;
      3     begin
      4      select price_his_key.nextval into log_seq_num from dual;
      5     dbms_output.put_line(log_seq_num);
      6    end;
      7
      8  /
    declare
    *
    ERROR 位于第 1 行:
    ORA-01422: 实际返回的行数超出请求的行数
    ORA-06512: 在line 4
    SQL> select *  from dual;D
    -
    XSQL>
      

  5.   

    SQL> select count(*) from dual;  COUNT(*)
    ----------
             2SQL>