你这么改试试create or replace procedure stuprocess(
tempp in stu.p%type,
tempe in stu.e%type,
tempm1 in stu.m1%type,
tempm2 in stu.m2%type,
tempm3 in stu.m3%type,
tempsum in result.sum%type)assturecord stu%rowtype;
stusum result.sum%type;
stuflag varchar2(4);
cursor stucursor is select * from stu;errmessage exception;begin
open stucursor;
loop
fetch stucursor into sturecord;
if stucursor%notfound then
raise errmessage;
endif;
stusum:=sturecord.e+sturecord.p+sturecord.m1+sturecord.m2+sturecord.m3
if (sturecord.e>=tempe and
sturecord.p>=tempp and
sturecord.m1>=tempm1 and
sturecord.m2>=tempm2 and
sturecord.m3>=tempm3 and
stusum>=tempsum) then
stuflag:="录取";
else
stuflag:="落选";
endif;
exit when stucursor%notfound;
insert into result values(sturecord.bh,sturecord.xm,sturecord.lb,sturecord.e,sturecord.p,sturecord.m1,sturecord.m2,sturecord.m3,stusum,stuflag);
end loop;
close stucursor;
commit;
exception when errmessage then
dbms_output.putline("can not open the table");end;
tempp in stu.p%type,
tempe in stu.e%type,
tempm1 in stu.m1%type,
tempm2 in stu.m2%type,
tempm3 in stu.m3%type,
tempsum in result.sum%type)assturecord stu%rowtype;
stusum result.sum%type;
stuflag varchar2(4);
cursor stucursor is select * from stu;errmessage exception;begin
open stucursor;
loop
fetch stucursor into sturecord;
if stucursor%notfound then
raise errmessage;
endif;
stusum:=sturecord.e+sturecord.p+sturecord.m1+sturecord.m2+sturecord.m3
if (sturecord.e>=tempe and
sturecord.p>=tempp and
sturecord.m1>=tempm1 and
sturecord.m2>=tempm2 and
sturecord.m3>=tempm3 and
stusum>=tempsum) then
stuflag:="录取";
else
stuflag:="落选";
endif;
exit when stucursor%notfound;
insert into result values(sturecord.bh,sturecord.xm,sturecord.lb,sturecord.e,sturecord.p,sturecord.m1,sturecord.m2,sturecord.m3,stusum,stuflag);
end loop;
close stucursor;
commit;
exception when errmessage then
dbms_output.putline("can not open the table");end;
解决方案 »
- 视图每次只能修改一个基表?
- 请帮忙看看使用关联查询或者是with.. as能否优化如下sql语句?
- 问下,,ORACLE里面什么时候用COMMIT啊?
- windows上启动OEM
- 表中的主键存在外键关联,禁止删除记录以及更新主键
- 求一SQL语句
- 急急急! oracle启动问题!
- 求助!oracle和sqlserver能否在一台计算机上共存?
- oracle问题,请教高手,给100分
- Redhat9下Oracle
- 大伙救命啊!寻找ORACLE数据库的LINUX版本,当然指得是CD版了
- 以回车符结束的fields terminated by X'09' 语句怎么写?我的表只有一个字段,想从一个txt文件导入数据
tempp in stu.p%type,
tempe in stu.e%type,
tempm1 in stu.m1%type,
tempm2 in stu.m2%type,
tempm3 in stu.m3%type,
tempsum in result.sum%type)
as
sturecord stu%rowtype;
stusum result.sum%type;
stuflag varchar2(4);
cursor stucursor is select * from stu;begin
open stucursor;
loop
fetch stucursor into sturecord;
exit when stucursor%notfound;
stusum:=sturecord.e+sturecord.p+sturecord.m1+sturecord.m2+sturecord.m3
if (sturecord.e>=tempe) and
(sturecord.p>=tempp) and
(sturecord.m1>=tempm1) and
(sturecord.m2>=tempm2) and
(sturecord.m3>=tempm3) and
(stusum>=tempsum) then
stuflag:="录取";
else
stuflag:="落选";
end if;
insert into result values(sturecord.bh,sturecord.xm,sturecord.lb,sturecord.e,sturecord.p,sturecord.m1,sturecord.m2,sturecord.m3,stusum,stuflag);
end loop;
close stucursor;
commit;
exception
when others then
dbms_output.putline("can not open the table");end;
把传入变量写在括号里,as 你的变量.
create or replace procedure proc
(
vari1 char(6),
vari2 number(12)
)
as
yourvari1 char(6);
yourvari number(12);
......
......
......