模擬高考查詢系統

第一步:通過考號,判斷是否有此考生的信息

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;
/

 以後會有新的功能代碼添加到本博客中,請大家諒解,一個人不能把一個系統在短時間內完成它

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