create or replace procedure Getmax(d1 in date,d2 in date, max out number) is
temp1 number;
d3 date;
cursor c1 is
select time,shuiwei from sys.kushui;
begin
  open c1;
  loop
  fetch c1
  into d3,temp1;
  exit when c1%notfound;
  dbms_output.put_line( 'kushui'
                        ||temp1);
                       
  end loop;
  close c1;
  end Getmax;
 
测试的时候 发现运行错误,该怎么办呢 

解决方案 »

  1.   


    create or replace procedure Getmax
    (d1 in date,d2 in date) 
    is
    temp1 number;
    d3 date;
    rere varchar(20);
    cursor c1 is
    select time,shuiwei from sys.kushui;
    begin
      open c1;
      loop
      fetch c1 into d3,temp1;
      exit when c1%notfound;
      rere:=rere ||'kushui'||temp1;
      end loop;
      close c1;
        dbms_output.put_line(rere);
      end Getmax;
      

  2.   

    [code]
    create or replace procedure Getmax(d1    in date,
                                       d2    in date,
                                       max11 out number) is
        temp1 number;
        d3    date;
    --    max11  number;
        cursor c1 is
            select time,shuiwei from sys.kushui;
    begin
        max11 := 0;
        open c1;
        loop
            fetch c1
                into d3, temp1;
            exit when c1%notfound;
            dbms_output.put_line('kushui ' || temp1);
            max11 := max11 + 1;
        end loop;
        close c1;end Getmax;
    [/code]
      

  3.   

    输出值max为关键字,换个别的名称
      

  4.   

    不小心吧【=SQL】删除了就成空白回复了,惨了
      

  5.   


    create or replace procedure Getmax(d1 in date,d2 in date, max out number) is
    cursor c1 is
    select time,shuiwei from sys.kushui;
    e c1%rowtype;
    begin
     if not c1%ISOPEN then
      open c1;
      end if;
      
      fetch c1 into e;
      
      while c1%found loop
      dbms_output.put_line( 'kushui '||e.shuiwei);
      fetch c1 into e;
      end loop;
      
      close c1;
      end;
      

  6.   

    确实是 MAX 为关键字不能定义,谢谢了。