环境: 系统为winxp
      oracle9i 9.2.0.1.0表:SCOTT.GRADUATE
Create Table "SCOTT"."GRADUATE"(
  "BH"        number(10,0)    not null,
  "XM"        varchar2(10)    not null,
  "LB"        varchar2(10)    not null,
  "YINGYU"    number(4,1)     not null,
  "ZHENGZHI"  number(4,1)     not null,
  "ZHUANYE1"  number(4,1)     not null,
  "ZHUANYE2"  number(4,1)     not null,  
  "ZHUANYE3"  number(4,1)     not null)
TableSpace  "USERS"表:SCOTT.RESULTCreate Table "SCOTT"."RESULT"(
  "BH"         number(10,0)    not null,
  "XM"         varchar2(10)    not null,
  "LB"         varchar2(10)    not null,
  "YINGYU"     number(4,1)     not null,
  "ZHENGZHI"   number(4,1)     not null,
  "ZHUANYE1"   number(4,1)     not null,
  "ZHUANYE2"   number(4,1)     not null,  
  "ZHUANYE3"   number(4,1)     not null,
  "TOTALSCORE"  number(5,1) not null,
  "FLAG" varchar2(4) not null)
TableSpace  "USERS"
表:SCOTT.GRADUATE 插入数据:Insert Into "SCOTT"."GRADUATE"J(BH,XM,LB,YINGYU,ZHENGZHI,ZHUANYE1,ZHUANYE2,ZHUANYE3)
Values(2003080520,'张三丰','硕士',55,56,67,78,89);
Insert Into "SCOTT"."GRADUATE"J(BH,XM,LB,YINGYU,ZHENGZHI,ZHUANYE1,ZHUANYE2,ZHUANYE3)
Values(2003060555,'张翠山','硕士',66,78,78,89,92);
Insert Into "SCOTT"."GRADUATE"J(BH,XM,LB,YINGYU,ZHENGZHI,ZHUANYE1,ZHUANYE2,ZHUANYE3)
Values(2003056066,'张无忌','硕士',76,67,89,90,65);
Insert Into "SCOTT"."GRADUATE"J(BH,XM,LB,YINGYU,ZHENGZHI,ZHUANYE1,ZHUANYE2,ZHUANYE3)
Values(2003010989,'赵敏','硕士',45,59,74,66,56);
Insert Into "SCOTT"."GRADUATE"J(BH,XM,LB,YINGYU,ZHENGZHI,ZHUANYE1,ZHUANYE2,ZHUANYE3)
Values(2003050677,'周芷若','硕士',77,67,72,87,65);
Insert Into "SCOTT"."GRADUATE"J(BH,XM,LB,YINGYU,ZHENGZHI,ZHUANYE1,ZHUANYE2,ZHUANYE3)
Values(2003869401,'小昭','硕士',55,56,67,78,89);过程:scott.graduateprocesCreate or Replace Procedure scott.graduateproces(
  tempzhengzhi    in  scott.graduate.zhengzhi%type,
  tempyingyu      in  scott.graduate.yingyu%type,
  tempzhuanye1    in  scott.graduate.zhuanye1%type,
  tempzhuanye2    in  scott.graduate.zhuanye2%type,
  tempzhuanye3    in  scott.graduate.zhuanye3%type,
  temptotalscore  in  scott.graduate.result.totalscore%type)
  as
  graduaterecord scott.graduate%rowtype;
  graduatetotalscore  scott.result.totalscore%type;
  graduateflag  varchar2(4);
  cursor  graduatecursor  is
    select * from scott.graduate;
  errormessage  exception;
  begin
    open  graduatecursor;
    if  graduatecursor%notfound then
        raise errormessage;
    end if;
    loop
      fetch graduatecursor  into  graduaterecord;
      graduatetotalscore:=graduaterecord.yingyu+graduaterecord.zhengzhi+graduaterecord.zhuanye1+
                          graduaterecord.zhuanye2+graduaterecord.zhuanye3;
      if(graduaterecord.yingyu   >= tempyingyu    and
         graduaterecord.zhengzhi >= tempzhengzhi  and
         graduaterecord.zhuanye1 >= tempzhuanye1  and
         graduaterecord.zhuanye2 >= tempzhuanye2  and
         graduaterecord.zhuanye3 >= tempzhuanye3  and
         graduatetotalscore      >= temptotalscore) then
         graduateflag:='录取';
      else
         graduateflag:='落选';
      end if;
      exit  when graduatecursor%notfound;
      insert into scott.result(bh,xm,lb,zhengzhi,yingyu,zhuanye1,zhuanye2,zhuanye3,totalscore,flag)
      values(graduaterecord.bh,graduaterecord.xm,graduaterecord.lb,graduaterecord.yingyu,
             graduaterecord.zhengzhi,graduaterecord.zhuanye1,graduaterecord.zhuanye2,
             graduaterecord.zhuanye3,graduatetotalscore,graduateflag);
      end loop;
      close graduatecursor;
      commit;
      exception
      when errormessage then
        dbms_output.put_line('无法打开数据表');      
  end;  
  问题出现在过程这里:
使用SQL*PLUS WorkSheet 来编写:在按F5执行过程时,出现这个错误:警告: 创建的过程带有编译错误。用: show errors 显示如下揭示:
PROCEDURE SCOTT.GRADUATEPROCES 出现错误:LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      PL/SQL: Compilation unit analysis terminated
7/38     PLS-00302: 必须说明 'RESULT' 组件这个错误是什么意思??怎么解决

解决方案 »

  1.   

    过程:scott.graduateprocesCreate or Replace Procedure scott.graduateproces(
      tempzhengzhi in scott.graduate.zhengzhi%type,
      tempyingyu in scott.graduate.yingyu%type,
      tempzhuanye1 in scott.graduate.zhuanye1%type,
      tempzhuanye2 in scott.graduate.zhuanye2%type,
      tempzhuanye3 in scott.graduate.zhuanye3%type,
      temptotalscore in scott.graduate.result.totalscore%type)其中 scott.graduate.result.totalscore%type 中的result 有问题
      

  2.   

    tempzhengzhi in scott.graduate.zhengzhi%type,
    tempyingyu in scott.graduate.yingyu%type,
    tempzhuanye1 in scott.graduate.zhuanye1%type,
    tempzhuanye2 in scott.graduate.zhuanye2%type,
    tempzhuanye3 in scott.graduate.zhuanye3%type,
    把这个改成
    temptotalscore in scott.graduate.result.totalscore%type
    ---------------->
    temptotalscore in scott.result.totalscore%type
      

  3.   

    temptotalscore in scott.graduate.result.totalscore%type
    --这里你多输入了 .result
    temptotalscore in scott.graduate.totalscore%type
      

  4.   

    哪里
    graduate根本没有totalscore这个列,只有result中才有
    temptotalscore in scott.result.totalscore%typeXCT