Thursday, September 29, 2011

Students Result Calculation program using PL/SQL


Objective

An examination has been conducted to a class of 5 students and four scores of each student have been provided in the data along with  register number and name. Write a PL/SQL block to do the following
Assign a  letter grade to each student based on the average score;
Average Score     Grade
90-100                   a
75-89                      b
60-74                     c
50-59                     d
0-49                        e

Program

SQL> create table studres(regno number(4) primary key, name varchar(20), paper1 number(2), paper2 number(2), paper3 number(2), paper4 number(2));
Table created
SQL> insert into studres values(1001,’mini’, 23, 49, 44, 46);
1 row created
SQL> insert into studres values(1002,’safeer’, 40, 30, 20, 10);
1 row created
SQL> insert into studres values(1003,’baby’, 49, 39, 46, 45);
1 row created
 SQL> insert into studres values(1004,’danish’, 40, 10, 20, 22);
1 row created

SQL> insert into studres values(1005,’swetha’, 20, 18, 20, 15);
1 row created
SQL> alter table studres add( averg number(5,2), grade varchar(2));
Table altered
SQL> declare
2    cursor c is select * from studres;
3    v_avg studres.averg %type;
4    v_tot studres.tot%type;
5    v_grade studres.grade%type;
6    begin
7    for i in c loop
8    v_tot = i.paper1+i.paper2+i.paper3+i.paper4;
9 v_avg=v_tot/2;
10   if(v_avg>=85) then
11   v_grade:=’A’
12   elsif (v_avg>=65) then
13   v_good:=’B’;
14  elsif(v_avg>=40) then
15    v_grade:=’C’;
16    elsif(v_avg>=25) then
17 v_grade:=’D’;
18 else
19  v_grade:=’E’;
20 end if ;
21 update studres set averg=v_avg, grade=v_grad, where regno=i.regno;
22 end loop;
23  end;
24 /
PL/SQL procedure successfully completed
SQL> select* from studres;
REGNO     NAME     PAPER1     PAPER2     PAPER3     PAPER4     AVERG     GRADE
1001          mini            23               49              44             46             40.5            C
1002          safeer         40               30              20             10             25               D
1003          baby            49              39              46             45             44.75          C
1004          danish         40              10              20             22             23                E
1005          swetha        20              18              20             15             18.25          E

9 comments:

  1. Students Result Calculation Program Using Pl/Sql ~ Techietopics >>>>> Download Now

    >>>>> Download Full

    Students Result Calculation Program Using Pl/Sql ~ Techietopics >>>>> Download LINK

    >>>>> Download Now

    Students Result Calculation Program Using Pl/Sql ~ Techietopics >>>>> Download Full

    >>>>> Download LINK wS

    ReplyDelete
  2. Sometime I face an error issue. Can you explain how to fix it. One of the competitive exams is for the SSC. The UPSC simultaneously administers the SSC exam for training in the Army, Navy, and Air Force. If you need help passing the SSC exam and the top SSC training accessible, check out this list of SSC Coaching in Chandigarh facilities. If you're interested, you can learn more by visiting KPH Media India website.

    ReplyDelete
  3. Whatoop Low Voltage Switchgear is a high-quality electrical distribution and control device designed to provide reliable and safe power distribution and control in low voltage systems. It is suitable for a wide range of industrial, commercial, and residential applications.

    ReplyDelete
  4. A drop test machine is used to test the damage caused by dropping the product package and to evaluate the impact strength during transportation and handling. Our drop testers are used for the purpose of dropping tests while keeping the attitude of the specimen and investigating its effect. In addition, it can be used not only for electricity and electronics but also for drop tests in various fields such as medicine, food, and pharmaceutical. Linkotest has proudly served the drop test industry with mechanical drop testers for mobile products, rotating drum testers, drop testers for packages, and all types of drop testers for large items for over 23 years.

    ReplyDelete
  5. As a professional tube gift box manufacturer with over 12 years of experience, Hopak provides a remarkable array of custom gift box solutions with extraordinary printing quality. A tube gift box is a great tool to impact your brand. We come up with innovations in gift packaging with your requirements or design ideas. Hopak utilizes high-quality printing to make an attractive display for your packaging tube. It helps to make your brand more identified in the market and your products more memorable.

    ReplyDelete
  6. Stand up pouch Manufacturer are flexible and lightweight, which makes them more cost-effective to transport and store compared to rigid packaging. And have a larger surface area for branding and product information, making them great for marketing. Stand up pouches can be made from various materials, including recyclable and biodegradable options, making them more environmentally friendly. The design of stand-up pouches allows them to be easily displayed on store shelves and improves product visibility.

    ReplyDelete
  7. As a professional safety barrier manufacturer in China, Aotons provides two types of flexible safety barriers to reduce the risk of accidents, damage, and unscheduled downtime. One is the AEGIS safety barrier, which is made of AEGIS steel material, it is usually used as a parking barrier. Another is the ARMORFLEX® safety barrier, which is made of ARMORFLEX® material independently developed by our company, it is used as an industrial safety barrier. Aotons flexible safety barrier is the most durable and advanced flexible workplace barrier on the market, now it has been used by many brand companies, like Mengniu, Yili, TNT, DHL, BMW, Mercedes Benz, Volkswagen, P & G, etc.

    ReplyDelete