create or replace procedure find_bypage(pages number) is
begin
select * from(select rownum pages,* from book) where pages>(pages-1)
*10 and pages<pages*10;
end;
/
怎么回事?????????

解决方案 »

  1.   

    modify to:select * from(select rownum pages,* from book) 
        where pages between (pages-1)*10+1 to pages*10;
      

  2.   

    还是报错啊,您再帮我看看。
    create or replace procedure find_bypage(pages number) is
    begin
    select * from(select rownum pages,* from book) 
        where pages between (pages-1)*10+1 to pages*10;
    end;
    /
       SQL> show err;
    PROCEDURE FINDBOOKBY_PAGE 出现错误:LINE/COL ERROR
    -------- -----------------------------------------------------------------
    3/35     PLS-00103: 出现符号 "*"在需要下列之一时:
             (-+modnull<an identifier>
             <a double-quoted delimited-identifier><a bind variable>table
             avgcountcurrentmaxminpriorsqlstddevsumvarianceexecutethe
             foralltimetimestampintervaldate
             <a string literal with character set specification>
             <a number><a single-quoted SQL string>3/81     PLS-00103: 出现符号 "TO"在需要下列之一时:
             *&-+/atmodrem
             <an exponent (**)>and||LINE/COL ERROR
    -------- -----------------------------------------------------------------
             符号 "and在 "TO" 继续之前已插入。
      

  3.   

    哦!写错了,是between ... and .....select * from (select rownum pages,* from book) 
        where pages between (pages-1)*10+1 and pages*10;
      

  4.   

    大侠,求您了。怎么还是抱错啊???
    create or replace procedure findbookby_page(pages number) is
    begin
    select * from(select rownum pages,* from book) where pages between (pages-1)*10+1 and pages*10;
    end;
    /
    警告: 创建的过程带有编译错误。SQL> show err;
    PROCEDURE FINDBOOKBY_PAGE 出现错误:LINE/COL ERROR
    -------- -----------------------------------------------------------------
    3/35     PLS-00103: 出现符号 "*"在需要下列之一时:
             (-+modnull<an identifier>
             <a double-quoted delimited-identifier><a bind variable>table
             avgcountcurrentmaxminpriorsqlstddevsumvarianceexecutethe
             foralltimetimestampintervaldate
             <a string literal with character set specification>
             <a number><a single-quoted SQL string>
      

  5.   

    你的过程写错了,兄弟!你选出的又不是一条数据,当然要使用游标了,况且在过程中
    select ..... into.....from ....