HOME | LAB PROGRAMMING | RATIONAL ROSE DIAGRAM | COMPUTE GRAPHICS | CLASS DIAGRAM | NETWORK PROGRAMING | BEST OF THE SITE

Student Mark Analysis Database Information System Insert Data into Data Field in PL SQL programming

These algorithm it will insert the data into data filed Example data 8 is insert into data field roll no.
Source code in PL SQL programming insert data into data field
SQL> declare
2 ROLLNO NUMBER(5);
3 REG_NO NUMBER(10);
4 NAME VARCHAR2(20);
5 BRANCH CHAR(3);
6 YEAR NUMBER(1);
7 SMESTER NUMBER(1);
8 MARK1 NUMBER(3);
9 MARK2 NUMBER(3);
10 MARK3 NUMBER(3);
11 MARK4 NUMBER(3);
12 MARK5 NUMBER(3);
13 MARK6 NUMBER(3);
14 AGE NUMBER(2);
15 SEX CHAR(1);
16 ADDRESS VARCHAR2(20);
17 FATHER VARCHAR2(20);
18 result varchar2(20);
19 percentage number(6,2);
20 arrears number(1);
21 begin
22 arrears:=0;
23 rollno:=&rollno;
24 reg_no:=&reg_no;
25 name:='&name';
26 branch:='&branch';
27 mark1:=&mark1;
28 mark2:=&mark2;
29 mark3:=&mark3;
30 mark4:=&mark4;
31 mark5:=&mark5;
32 mark6:=&mark6;
33 if(mark1<50) then
34 arrears:=arrears+1;
35 end if;
36 if(mark2<50) then
37 arrears:=arrears+1;
38 end if;
39 if(mark3<50) then
40 arrears:=arrears+1;
41 end if;
42 if(mark4<50) then
43 arrears:=arrears+1;
44 end if;
45 if(mark5<50) then
46 arrears:=arrears+1;
47 end if;
48 if(mark6<50) then
49 arrears:=arrears+1;
50 end if;
51 percentage:=(mark1+mark2+mark3+mark4+mark5+mark6);
52 percentage:=percentage/6;
53 if(percentage>75) then
54 result:='distinction';
55 elsif(percentage>60) then
56 result:='1st class';
57 elsif(percentage>50) then
58 result:='2nd class';
59 end if;
60 if(arrears!=0) then
61 result:='fail';
62 end if;
63 insert into per_rec values(rollno,name,&age,'&sex','&address','&father');
64 insert into col_rec values(rollno,reg_no,name,branch,&YEAR,&SMESTER);
65 insert into marklist values(reg_no,mark1,mark2,mark3,mark4,mark5,mark6);
66 insert into mresult values(reg_no,percentage,result,arrears);
67 end;
68 /
PL/SQL procedure successfully completed.
SQL> /
Enter value for rollno: 8
old 23: rollno:=&rollno;
new 23: rollno:=8;
Enter value for reg_no: 32042380
old 24: reg_no:=&reg_no;
new 24: reg_no:=32042380;
Enter value for name: RAVI
old 25: name:='&name';
new 25: name:='RAVI';
Enter value for branch: IT
old 26: branch:='&branch';
new 26: branch:='IT';
Enter value for mark1: 60
old 27: mark1:=&mark1;
new 27: mark1:=60;
Enter value for mark2: 60
old 28: mark2:=&mark2;
new 28: mark2:=60;
Enter value for mark3: 60
old 29: mark3:=&mark3;
new 29: mark3:=60;
Enter value for mark4: 60
old 30: mark4:=&mark4;
new 30: mark4:=60;
Enter value for mark5: 60
old 31: mark5:=&mark5;
new 31: mark5:=60;
Enter value for mark6: 60
old 32: mark6:=&mark6;
new 32: mark6:=60;
Enter value for age: 20
Enter value for sex: M
Enter value for address: 12 NADAN ST
Enter value for father: GIRI
old 64: insert into per_rec values(rollno,name,&age,'&sex','&address','&father');
new 64: insert into per_rec values(rollno,name,20,'M','12 NADAN ST','GIRI');
Enter value for year: 3
Enter value for smester: 5
old 65: insert into col_rec1 values(rollno,reg_no,name,branch,&YEAR,&SMESTER);
new 65: insert into col_rec1 values(rollno,reg_no,name,branch,3,5);
PL/SQL procedure successfully completed.
Student Mark Analysis Database Information system data insert into data field successfully.

0 comments: