模拟高考查询系统

第一步:通过考号,判断是否有此考生的信息

create or replace procedure logon ( temp in int)
as
a1 int:=0;
begin
select distinct sid*1 into a1 from stu_info where sid=temp;
if a1>0 then
dbms_output.put_line('login success !');
end if;
end;
/

第二步:通过考号,查询考生的总分

create or replace procedure sumscore( temp in int)
as
a1 int:=0;
begin
select sum(oscore) into a1 from stu_score where sid=temp;
dbms_output.put_line('sum:'||a1);
end;
/

第三步:通过考号得到总分,能够查询到够分数线的学校信息(未安省份查询)

create or replace procedure school( temp in int)
as
begin
 declare
  cursor cur is (select * from sch_info where  hscore<(select sum(oscore) from stu_score where sid=temp));
  school sch_info%rowtype;
  begin
  open cur;
  loop
  fetch cur into school;
  exit when cur%notfound;
  dbms_output.put_line(school.hname);
  end loop;
  close cur;
  end;
end;
/

 以后会有新的功能代码添加到本博客中,请大家谅解,一个人不能把一个系统在短时间内完成它

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章