create or replace procedure graduateprocess
(
tempzhengzhi in graduate.zhengzhi%type,
tempyingyu in graduate.yingyu%type,
tempzhuanye1 in graduate.zhuanye1%type,
tempzhuanye2 in graduate.zhuanye2%type,
tempzhuanye3 in graduate.zhuanye3%type,
temptotalscore in result.totalscore%type
) as
graduaterecord graduate%rowtype;
graduatetotalscore result.totalscore%type;
graduateflag varchar2(4);
cursor graduatecursor is select * from graduate;
errormessage exception; begin
open graduatecursor;
if graduatecursor%notfound
then
raise errormessage; end if;
loop
fetch graduatecursor into graduaterecord; /*calulate total score*/
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 result(bh,xm,lb,zhengzhi,yingyu,zhuanye1,zhuanye2,zhuanye3,totalscore,flag)
values (graduaterecord.bh,graduaterecord.xm,graduaterecord.lb,graduaterecord.zhengzhi,graduaterecord.yingyu,graduaterecord.zhuanye1,graduaterecord.zhuanye2,graduaterecordzhuanye3,graduatetotalscore,graduateflag);
exit when graduatecursor%notfound;
end loop;
close graduatecursor;
commit;
exception
when errormessage
then
dbms_output.put_line('Cant open the table.');
end;执行后:
SQL> start test/graduatetest.sql
51 /Warning: Procedure created with compilation errors.SQL> show errors
Errors for PROCEDURE GRADUATEPROCESS:LINE/COL ERROR
-------- -----------------------------------------------------------------
39/3 PL/SQL: SQL Statement ignored
40/157 PL/SQL: ORA-00984: column not allowed here没找到原因。求教各位。谢谢!
(
tempzhengzhi in graduate.zhengzhi%type,
tempyingyu in graduate.yingyu%type,
tempzhuanye1 in graduate.zhuanye1%type,
tempzhuanye2 in graduate.zhuanye2%type,
tempzhuanye3 in graduate.zhuanye3%type,
temptotalscore in result.totalscore%type
) as
graduaterecord graduate%rowtype;
graduatetotalscore result.totalscore%type;
graduateflag varchar2(4);
cursor graduatecursor is select * from graduate;
errormessage exception; begin
open graduatecursor;
if graduatecursor%notfound
then
raise errormessage; end if;
loop
fetch graduatecursor into graduaterecord; /*calulate total score*/
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 result(bh,xm,lb,zhengzhi,yingyu,zhuanye1,zhuanye2,zhuanye3,totalscore,flag)
values (graduaterecord.bh,graduaterecord.xm,graduaterecord.lb,graduaterecord.zhengzhi,graduaterecord.yingyu,graduaterecord.zhuanye1,graduaterecord.zhuanye2,graduaterecordzhuanye3,graduatetotalscore,graduateflag);
exit when graduatecursor%notfound;
end loop;
close graduatecursor;
commit;
exception
when errormessage
then
dbms_output.put_line('Cant open the table.');
end;执行后:
SQL> start test/graduatetest.sql
51 /Warning: Procedure created with compilation errors.SQL> show errors
Errors for PROCEDURE GRADUATEPROCESS:LINE/COL ERROR
-------- -----------------------------------------------------------------
39/3 PL/SQL: SQL Statement ignored
40/157 PL/SQL: ORA-00984: column not allowed here没找到原因。求教各位。谢谢!
values (graduaterecord.bh,graduaterecord.xm,graduaterecord.lb,graduaterecord.zhengzhi,graduaterecord.yingyu,graduaterecord.zhuanye1,graduaterecord.zhuanye2,graduaterecordzhuanye3,graduatetotalscore,graduateflag);
是这句的问题,可是怎么改?