0% found this document useful (0 votes)
31 views40 pages

Lakme Project

The document outlines a lab syllabus for an Oracle database course. It includes creating tables, inserting data, primary and foreign keys, different types of queries including advanced queries using subqueries and set operators, joins, functions, views, triggers, and PL/SQL procedures.

Uploaded by

sselva3064
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views40 pages

Lakme Project

The document outlines a lab syllabus for an Oracle database course. It includes creating tables, inserting data, primary and foreign keys, different types of queries including advanced queries using subqueries and set operators, joins, functions, views, triggers, and PL/SQL procedures.

Uploaded by

sselva3064
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

SCHOOL OF ARTS AND SCIENCE

DEPARTMENT OF COMPUTER SCIENCE

Sub Code: 17120SEC64L


Sub Title: Oracle Lab

Prepared By

R.Rajayogeswari
17120SEC64L Oracle Lab

Syllabus

1. Write SQL queries to create the following tables and insert rows in it.
Employee (eno, ename, deptno, salary, designation)
Dept (deptno, deptname, location)
Student (rollno, name, course, paper1, paper2, paper3)

2. Write SQL queries to create primary key and foreign key constraints in the above given
tables and perform all types of simple retrieval.

3. Write SQL queries to perform all types of advance retrieval using (i) nested sub queries (ii)
set operators.

4. Write SQL queries to perform all types of joins.

5. Write SQL queries to illustrate all built-in functions.

6. Write SQL queries to create views and index/indices for the tables Employee, Dept and
Student.

7. Write a database trigger to prevent transactions during weekend. Create PL/SQL


procedures and store them in a package and execute them in the command prompt.

8. Write a PL/SQL program that prints mark sheet of students in a University using cursor.

9. Payroll using forms

10. Mark sheet processing using forms


Ex No :1

Aim:

To Write SQL queries to create the following tables and insert rows in it. Employee (eno,
ename, deptno, salary, designation), Dept (deptno, deptname, location), Student (rollno, name,
course, paper1, paper2, paper3).

Procedure:

Step 1: Write the create command for employee table with the datatype (eno numeric(5),ename

varchar(20),deptno numeric(3),salary numeric(6),desig varchar(10));

Step 2: Describe the structure of employee table using DESC command.

Step 3: Insert values into the table using INSERT command.

Step 4: Display all the records using SELECT command.

Step 5: Do the same process for department and student.

Step 6: stop the program.

SQL Commands:

SQL> create table employee(eno numeric(5),ename varchar(20),deptno numeric(3),salary


numeric(6),desig varchar(10));

Table created.

SQL> desc employee

Name Null? Type

------------------------------- -------- ----

ENO NUMBER(5)

ENAME VARCHAR2(20)

DEPTNO NUMBER(3)

SALARY NUMBER(6)

DESIG VARCHAR2(10)
SQL> create table department(deptno numeric(5),deptname varchar(20),location varchar(10));

Table created.

SQL> desc department

Name Null? Type

------------------------------- -------- ----

DEPTNO NUMBER(5)

DEPTNAME VARCHAR2(20)

LOCATION VARCHAR(20)

SQL> create table student(rno numeric(5),name varchar(20),paper1 numeric(3),paper2


numeric(3), paper3 numeric(3));

Table created.

SQL> desc student

Name Null? Type

------------------------------- -------- ----

RNO NUMBER(5)

NAME VARCHAR2(20)

PAPER1 NUMBER(3)

PAPER2 NUMBER(3)

PAPER3 NUMBER(3)

SQL> insert into employee(&eno,’&ename’,&deptno ,&salary ,’&desig’);

Enter the value of ENO: 100

Enter the value of ENAME: ALICE

Enter the value of DEPTNO:10

Enter the value of SALARY:10000


Enter the value of DESIG:MANAGER

1 row inserted

SQL>/

Enter the value of ENO:101

Enter the value of ENAME:BOB

Enter the value of DEPTNO:20

Enter the value of SALARY:10000

Enter the value of DESIG:MANAGER

1 row inserted

SQL>/

Enter the value of ENO:102

Enter the value of ENAME:CAROLINE

Enter the value of DEPTNO:30

Enter the value of SALARY:10000

Enter the value of DESIG: MANAGER

1 row inserted

SQL>/

Enter the value of ENO:103

Enter the value of ENAME:DAVID

Enter the value of DEPTNO:10

Enter the value of SALARY:5000

Enter the value of DESIG:CLERK

1 row inserted
SQL>/

Enter the value of ENO:104

Enter the value of ENAME:EVA

Enter the value of DEPTNO:20

Enter the value of SALARY:5000

Enter the value of DESIG:CLERK

1 row inserted

SQL>/

Enter the value of ENO:105

Enter the value of ENAME:FEROSE

Enter the value of DEPTNO:30

Enter the value of SALARY:5000

Enter the value of DESIG:CLERK

1 row inserted

SQL>SELECT * FROM EMPLOYEE;

ENO ENAME DEPTNO SALARY


DESIG

101 ALICE 10 10000 MGR

102 BOB 20 10000 MGR

103 CAROLINE 30 10000 MGR

104 DAVID 10 5000 CLERK

105 EVA 20 5000 CLERK

106 FEROSE 30 5000 CLERK


SQL> insert into department(&dno,’&dname’,’&location’);

Enter the value of dno: 10

Enter the value of dname: computer science

Enter the value of location: I floor

SQL>/

Enter the value of dno: 20

Enter the value of dname: Commerce

Enter the value of location: Ii floor

SQL>/

Enter the value of dno: 30

Enter the value of dname: mathematics

Enter the value of location: III floor

SQL>SELECT * FROM DEPARTMENT;

DNO DNAME LOCATION

10 COMPUTER SCIENCE I FLOOR

20 COMMERCE II FLOOR

30 MATHEMATICS III FLOOR

SQL>INSERT INTO STUDENT


VALUES(&RNO,’&SNAME’,&PAPER1,&PAPER2,&PAPER3);

ENTER THE VALUE OF RNO:100

ENTER THE VALUE OF SNAME:ANI


ENTER THE VALUE OF PAPER1:50

ENTER THE VALUE OF PAPER2:60

ENTER THE VALUE OF PAPER3:50

SQL>/

ENTER THE VALUE OF RNO:101

ENTER THE VALUE OF SNAME:ABI

ENTER THE VALUE OF PAPER1:50

ENTER THE VALUE OF PAPER2:50

ENTER THE VALUE OF PAPER3:50

SQL>/

ENTER THE VALUE OF RNO:102

ENTER THE VALUE OF SNAME:AKIL

ENTER THE VALUE OF PAPER1:80

ENTER THE VALUE OF PAPER2:60

ENTER THE VALUE OF PAPER3:50

SELECT * FROM STUDENT;

RNO SNAME PAPER1 PAPER2 PAPER3

100 ANI 50 60 50

101 ABI 50 50 50

102 AKIL 80 60 50

Result:

Thus the commands have been executed.


EX :NO:02

Aim:

To Write SQL queries to create primary key and foreign key constraints in the above
given tables and perform all types of simple retrieval.

Procedure:

Step 1: Create two tables name with department and employee.

Step 2: Insert rows into both tables.

Step 3: Set primary key for department in the field of dno.

Step 4: Set primary key for employee in the field of eno.

Step 5: Using primary key and foreign key, retrieve the records.

Step 6: Select records using some constraints.

Step 7: Same as the above steps, do all the process.

SQL Commands:

SQL> create table department(dno numeric(5) primary key,dname varchar(20),location


varchar(10));

Table created

SQL> create table employee(eno numeric(5) primary key,ename varchar(20),dno


numeric(3)references department(dno),salary numeric(6),designation varchar(10));

Table created

SQL> insert into employee(&eno,’&ename’,&deptno ,&salary ,’&designation’);

Enter the value of ENO: 100

Enter the value of ENAME: ALICE

Enter the value of DEPTNO:10

Enter the value of SALARY:10000


Enter the value of DESIG:CLERK

1 row inserted

SQL>/

Enter the value of ENO: 100

Enter the value of ENAME: ALICE

Enter the value of DEPTNO:10

Enter the value of SALARY:10000

Enter the value of DESIG:CLERK

ERR:…………

SQL>/

Enter the value of ENO: NULL

Enter the value of ENAME: ALICE

Enter the value of DEPTNO:10

Enter the value of SALARY:10000

Enter the value of DESIG:CLERK

ERR:………………………

SQL> insert into department(&dno,’&dname’,’&location’);

Enter the value of DNO: 10

Enter the value of DNAME: COMPUTER SCIENCE

Enter the value of LOCATION: I FLOOR

1 row inserted

SQL>/

Enter the value of DNO: 10

Enter the value of DNAME: COMPUTER SCIENCE


Enter the value of LOCATION: I FLOOR

ERR…….

SQL>/

Enter the value of DNO: 20

Enter the value of DNAME: COMMERCE

Enter the value of LOCATION: II FLOOR

1 row inserted

SQL>/

Enter the value of DNO: 30

Enter the value of DNAME: MATHEMATICS

Enter the value of LOCATION: III FLOOR

1 row inserted

SQL>/

Enter the value of DNO: NULL

Enter the value of DNAME: COMPUTER SCIENCE

Enter the value of LOCATION: I FLOOR

ERR………………….

SQL>SELECT * FROM DEPARTMENT;

DNO DNAME LOCATION

10 COMPUTER SCIENCE I FLOOR

20 COMMERCE II FLOOR

30 MATHS III FLOOR

Result:

Thus the commands have been executed.


EX:NO:03

Aim:

To Write SQL queries to perform all types of advance retrieval using (i) nested sub
queries (ii) set operators.

Procedure:

Step 1: Create two tables name with department and employee.

Step 2: Set dno as primary key in Department table.

Step 3: Set eno as primary key in Employee Table.

Step 4: Insert rows into both tables using set operators.

Step 5: Write a query inside a query to retrieve some records.

Step 6: Do the process again and again.

SQL>SELECT * FROM EMPLOYEE WHERE DNO=(SELECT DNO FROM


DEPARTMENT WHERE DNAME=’COMPUTER SCIENCE’);

ENO ENAME DEPTNO SALARY


DESIG

101 ALICE 10 10000 MANAGER

104 DAVID 10 50000 CLERK

SQL>SELECT * FROM EMPLOYEE WHERE SAL>(SELECT SAL FROM EMPLOYEE


WHERE ENAME=’ALICE’);

NO ENAME DEPTNO SALARY DESIG

102 BOB 20 10000 MGR

103 CAROLINE 30 10000 MGR

104 DAVID 10 5000 CLERK

105 EVA 20 5000 CLERK


SET OPERATORS

SELECT DNO FROM DEPARTMENT INTERSECT SELECT DNO FROM EMPLOYEE;

DNO

------

10

20

30

SELECT DNO FROM DEPARTMENT UNION SELECT DNO FROM EMPLOYEE;

DNO

------

10

20

30

SELECT DNO FROM DEPARTMENT MINUS SELECT DNO FROM EMPLOYEE;

NO RECORDS FOUND

Result:

Thus the commands have been executed.


EX:NO:04

Aim:

To Write SQL queries to perform all types of joins.

Procedure:

Step 1: Create two tables name with department and employee.

Step 2: Set dno as primary key in Department table.

Step 3: Set eno as primary key in Employee Table.

Step 4: Insert number of rows into both tables.

Step 5: Using EQUI join Operator, join the two tables.

Step 6: Using Self join operator, join Particular fields from both tables.

Step 7: Using Outer Join Operator, join the tables which satisfy some Constraints.

SQL Commands:

TYPES OF JOIN

CARTESIAN JOIN

SELECT ENO,ENAME,DNAME,LOCATION FROM EMPLOYEE,DEPARTMENT;

ENO ENAME DNAME LOCATION

101 ALICE COMPUTER SCIENCE I FLOOR

102 BOB COMMERCE II FLOOR

103 CAROLINE MATHEMATICS III FLOOR

104 DAVID COMPUTER SCIENCE I FLOOR

105 EVA COMMERCE II FLOOR

106 FEROSE MATHEMATICS III FLOOR


EQUI JOIN

SELECT ENO,ENAME,DNO,DNAME FROM EMPLOYEE,DEPARTMENT WHERE


EMPLOYEE.DNO=DEPARTMENT.DNO;

ENO ENAME DNAME LOCATION

101 ALICE COMPUTER SCIENCE I FLOOR

102 BOB COMMERCE II FLOOR

103 CAROLINE MATHEMATICS III FLOOR

104 DAVID COMPUTER SCIENCE I FLOOR

105 EVA COMMERCE II FLOOR

106 FEROSE MATHEMATICS III FLOOR

SELF JOIN

SELECT STAFF.ENO,STAFF.ENAME,MANAGER.DNAME FROM STAFF,MANAGER;

ENO ENAME DNAME

101 ALICE COMPUTER SCIENCE

102 BOB COMMERCE

103 CAROLINE MATHEMATICS

104 DAVID COMPUTER SCIENCE

105 EVA COMMERCE

106 FEROSE MATHEMATICS


OUTER JOIN

SELECT * FROM EMPLOYEE,DEPARTMENT WHERE


EMPLOYEE.DNO=DEPARTMENT.DNO;

ENO ENAME DNAME LOCATION

101 ALICE COMPUTER SCIENCE I FLOOR

102 BOB COMMERCE II FLOOR

103 CAROLINE MATHEMATICS III FLOOR

104 DAVID COMPUTER SCIENCE I FLOOR

105 EVA COMMERCE II FLOOR

106 FEROSE MATHEMATICS III FLOOR

Result:

Thus the commands have been executed.


EX NO: 5

Aim:

To Write SQL queries to illustrate all built-in functions.

Procedure:

Step 1: Create a table in the name of DUAL.

Step 2: Insert some rows in it.

Step 3: Perform Some Character Operations Using CONCAT, INITCAP, LOWER, UPPER,

LENGTH Operators.

Step 4: Perform Some Arithmetic Operations Using POWER, SQRT, CEIL, FLOOR, ROUND

Operators.

Step 5: Perform some other Operations using AVG, MAX, MIN, COUNT operators.

Step 6: Do the process again and again.

SQL Commands:

CHARACTER FUNCTIONS

SQL>SELECT CONCAT(‘COMPUTER’,’ APPLICATION’) FROM DUAL;

SQL>COMPUTER SCIENCE

SQL>SELECT INITCAP(‘welcome’) FROM DUAL;

SQL>Welcome

SQL>SELECT LOWER(‘WELCOME’) FROM DUAL;

SQL>welcome

SQL>SELECT UPPER(‘welcome’) FROM DUAL;

SQL>WELCOME

SQL>SELECT LENGTH(‘welcome’) FROM DUAL;


SQL>7

ARITHMETIC FUNCTIONS

SQL>SELECT POWER(2,3) FROM DUAL;

SQL>8

SQL>SELECT SQRT(625) FROM DUAL;

SQL>25

SQL>SELECT CEIL(25.05) FROM DUAL;

SQL>25

SQL>SELECT FLOOR(25.05) FROM DUAL;

SQL>05

SQL>SELECT ROUND(25.05555) FROM DUAL;

SQL>25.06

OTHER FUNCTIONS

SQL>SELECT AVG(10,20,30,40) FROM DUAL;

SQL>25

SQL>SELECT MAX(2,3,6,8,3,9) FROM DUAL;

SQL>9

SQL>SELECT MIN(2,3,6,8,3,9) FROM DUAL;

SQL>2

SQL>SELECT COUNT(2,3,6,8,3,9) FROM DUAL;

SQL>6

Result:

Thus the commands have been executed.


EX NO: 06

Aim:

To Write SQL queries to create views and index/indices for the tables Employee, Dept and
Student.

Procedure:

Step 1: Create three tables in the name of Employee, Dept and Student.

Step 2: Insert some rows in all the three tables.

Step 3: Create VIEWS in Employee table using SELECT Operator.

Step 4: Create INDEX in Employee table for some fields.

Step 5: Do the same process for Dept table.

Step 6: Do the same process for Student table also.

SQL Commands:

CREATE VIEW VIEW_NAME AS SELECT STATEMENT;

SQL>CREATE VIEW EMP_VIEW AS SELECT * FROM EMP;

VIEW CREATED

SQL>SELECT * FROM EMP_VIEW;

ENO ENAME DEPTNO SALARY DESIG

101 ALICE 10 10000 MGR

102 BOB 20 10000 MGR

103 CAROLINE 30 10000 MGR

104 DAVID 10 5000 CLERK

105 EVA 20 5000 CLERK

106 FEROSE 30 5000 CLERK


SQL>CREATE VIEW DEPT_VIEW AS SELECT DNO,DNAME FROM DEPT;

VIEW CREATED

SQL>SELECT * FROM DEPT_VIEW;

DNO DNAME

--------------------------------------------------

10 COMPUTER SCIENCE

20 COMMERCE

30 MATHEMATICS

SQL>CREATE VIEW STUD_VIEW AS SELECT RNO,SNAME FROM STUD;

VIEW CREATED

SQL>SELECT * FROM STUD;

RNO SNAME

---------------------------------------------------------------

100 ANI

101 ASWIN

102 BANU

103 BOB

104 CAT

INDEX

CREATE INDEX INDEX_NAME ON TABLE_NAME(FIELD_NAME1,FIELD_NAME2…);

SQL>CREATE INDEX EMP_INDEX ON EMP(ENO);

INDEX CREATED

SQL>CREATE INDEX DEPT_INDEX ON DEPT(DNO);


INDEX CREATED

SQL>CREATE INDEX STUD_INDEX ON STUD(RNO);

INDEX CREATED

Result:

Thus the commands have been executed.


Ex No: 7:

Aim:

To write a database trigger to prevent transactions during weekend. Create PL/SQL


procedures and store them in a package and execute them in the command prompt.

Procedure:

Step 1: Create a table with some columns for student.

Step 2: Insert rows in it.

Step 3: Create a package for Student table.

Step 4: Insert some rows in it.

Step 5: Execute Package commands Properly.

Step 6: Create Trigger for Student Table with some Constraints.

Step 7: Execute the Trigger Commands Properly.

SQL Commands:

/*PACKAGE*/

SQL> create table stud10(studno number(5),studname varchar2(10),mark1 number(5),mark2


number(5));

Table created.

SQL> insert into stud10 values(&studno,'&studname',&mark1,&mark2);

Enter value for studno: 1001

Enter value for studname: emaan

Enter value for mark1: 90

Enter value for mark2: 90

old 1: insert into stud10 values(&studno,'&studname',&mark1,&mark2)

new 1: insert into stud10 values(1001,'emaan',90,90)

1 row created.
SQL> /

Enter value for studno: 1002

Enter value for studname: maji

Enter value for mark1: 80

Enter value for mark2: 85

old 1: insert into stud10 values(&studno,'&studname',&mark1,&mark2)

new 1: insert into stud10 values(1002,'maji',80,85)

1 row created.

SQL> /

Enter value for studno: 1003

Enter value for studname: sami

Enter value for mark1: 78

Enter value for mark2: 90

old 1: insert into stud10 values(&studno,'&studname',&mark1,&mark2)

new 1: insert into stud10 values(1003,'sami',78,90)

1 row created.

SQL> select * from stud10;

STUDNO STUDNAME MARK1 MARK2

--------- ---------- --------- ---------

1001 emaan 90 90

1002 maji 80 85

1003 sami 78 90
SQL> create or replace package studpack is

procedure stud_add(rno number,name1 varchar2,m1 number,m2 number);

procedure stud_modi(rno number,name1 varchar2,m1 number,m2 number);

procedure stud_del(rno number);

end;

Package created.

SQL> create or replace package body studpack is

procedure stud_add(rno number,name1 varchar2,m1 number,m2 number)is

begin

insert into stud10(studno,studname,mark1,mark2)values(rno,name1,m1,m2);

commit;

end;

procedure stud_modi(rno number,name1 varchar2,m1 number,m2 number)is

begin

update stud10 set studname=name1,mark1=m1,mark2=m2 where studno=rno;

commit;

end;

procedure stud_del(rno number)is

begin

delete from stud10 where studno=rno;

commit;

end;

end;
Package body created.

SQL> execute studpack.stud_add(1004,'nasi',89,98);

PL/SQL procedure successfully completed.

SQL> select * from stud10;

STUDNO STUDNAME MARK1 MARK2

--------- ---------- --------- ---------

1001 emaan 90 90

1002 maji 80 85

1003 sami 78 90

1004 nasi 89 98

SQL> execute studpack.stud_modi(1004,'rufi',90,80);

PL/SQL procedure successfully completed.

SQL> select * from stud10;

STUDNO STUDNAME MARK1 MARK2

--------- ---------- --------- ---------

1001 emaan 90 90

1002 maji 80 85

1003 sami 78 90

1004 rufi 90 80
SQL> execute studpack.stud_del(1004);

PL/SQL procedure successfully completed.

SQL> select * from stud10;

STUDNO STUDNAME MARK1 MARK2

--------- ---------- --------- ---------

1001 emaan 90 90

1002 maji 80 85

1003 sami 78 90

/*TRIGGER*/

SQL> select * from stud;

NO NAME M1 M2

---------- ---------- ---------- ----------

101 aadhi 99 100

102 jesi 99 90

103 rufi 70 60

104 mefi 55 70

105 jas 60 60

SQL> create or replace trigger dpl


after insert or delete or update on stud

for each row

begin

if inserting then

dbms_output.put_line('Sucessfully Inserting');

elsif updating then

dbms_output.put_line('Sucessfully updating');

elsif deleting then

dbms_output.put_line('Sucessfully deleted');

end if;

end;

Trigger created.

SQL> insert into stud values(106,'asmi',44,66);

Sucessfully Inserting

1 row created.

SQL> delete from stud where no=106;

Sucessfully deleted

1 row deleted.

SQL> update stud set name='jasi' where no=105;


Sucessfully updating

1 row updated.

SQL> select * from stud;

NO NAME M1 M2

---------- ---------- ---------- ----------

101 aadhi 99 100

102 jesi 99 90

103 rufi 70 60

104 mefi 55 70

105 jasi 60 60

Result:

Thus the SQL Commands have been executed properly.


Ex No: 8

Aim:

To Write a PL/SQL program that prints mark sheet of students in a University using cursor.

Procedure:

Step 1: Create a table for Student with some fields.

Step 2: Insert some rows in it.

Step 3: Write a cursor program for student.

Step 4: Use loop for repeated statements in trigger.

Step 5: Declare the results which satisfy some constraints.

Step 6: Do the process again and again.

PL/SQL Commands:

SQL> declare

cursor c1 is select no,name,m1,m2 from stud;

type studrec is record(

r stud.no%type,

n stud.name%type,

mark1 stud.m1%type,

mark2 stud.m2%type);

srec studrec;

total number(4);

ave number(5,2);

result char(5);

grade char(12);

begin
open c1;

dbms_output.put_line('Rollno Name Mark1 Mark2'|| ' Total Result Average


Grade');

loop

fetch c1 into srec;

exit when c1 %notfound;

total:=srec.mark1+srec.mark2;

ave:=total/2;

if srec.mark1>49 and srec.mark2>49 then

result:='PASS';

else

result:='FAIL';

end if;

if ave>=75 then

grade:='Distinction';

elsif ave>59 and ave<75 then

grade:='First';

elsif ave>49 and ave<60 then

grade:='second';

else

grade:='Nill';

end if;

dbms_output.put_line(srec.r||' '|| srec.n||' '|| srec.mark1||' '||srec.mark2||' '||

total||' '|| result||' '||ave||' '||grade);

end loop;

close c1;
end;

Sql>Set serveroutput on

Rollno Name Mark1 Mark2 Total Result Average Grade

101 aadhi 99 100 199 PASS 99.5 Distinction

102 jesi 99 90 189 PASS 94.5 Distinction

103 rufi 70 60 130 PASS 65 First

104 mefi 55 70 125 PASS 62.5 First

105 jasi 60 60 120 PASS 60 First

Result:

Thus the PL/SQL Commands have been executed properly.


Ex No: 9

Aim:

To create Oracle forms for Payroll systems.

Procedure:

Step 1: Create a table, name with Payroll.

Step 2: Column ID to have a key column Date where you will store day column Pay Head.

Step 3: Write the coding in the push button.

Step 4: Mention block name and item type in mouse click.

Step 5: Do same process for create, insert, previous, next, save and exit.

Step 6: Calculate Bpay in the mouse click option.

SQL Commands:

SQL> Create table pay( name varchar(20), eno number(3), design varchar(20), Bpay
number(7,2), DA number(7,2), CCA number(7,2), Allow number(7,2), GP number(7,2), DED
number(7,2), Netpat number(7,2));

Table created.

Coding in the PUSH Button:

BLOCK NAME: PAY

ITEM NAME: CREATE

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

CREATE_RECORD;
BLOCK NAME: PAY

ITEM NAME: DELETE

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

DELETE_RECORD;

BLOCK NAME: PAY

ITEM NAME: PREVIOUS

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

PREVIOUS_RECORD;

BLOCK NAME: PAY

ITEM NAME: NEXT

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

NEXT_RECORD;

BLOCK NAME: PAY

ITEM NAME: FIRST

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL


TRIGGER NAME: WHEN_MOUSE_CLICK

FIRST_RECORD;

BLOCK NAME: PAY

ITEM NAME: LAST

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

LAST_RECORD;

BLOCK NAME: PAY

ITEM NAME: EXECUTE

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

EXECUTE_RECORD;

BLOCK NAME: PAY

ITEM NAME: SAVE

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

SAVE_RECORD;
BLOCK NAME: PAY

ITEM NAME: BPAY

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

BPAY_RECORD;

:pay.da:=:pay.bpay*0.5

:pay.cca:=pay.bpay*0.2

:pay.allow:=pay.bpay*0.1

:gp:=:bpay+:da+:cca+:allow;

Go_item(‘pay.gp’);

Result:

Thus the Payroll systems using forms has been executed.


Ex.No: 10

Aim:

To create a Mark sheet using forms.

Procedure:

Step 1: Create a table, name with mark.

Step 2: insert some rows in it.

Step 3: Write the coding in the push button.

Step 4: Mention block name and item type in mouse click.

Step 5: Do same process for create, insert, previous, next, save and exit.

Step 6: Calculate total marks.

Step 7: Calculate result using id condition.

SQL Commands:

SQL> create table mark(sno number(3), name varchar(20), m1 number(3), m2 number(3), total
number(3), average number(5,2), result varchar(10));

Table created.

Coding in the PUSH Button:

BLOCK NAME: MARK

ITEM NAME: CREATE

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

CREATE_RECORD;
BLOCK NAME: MARK

ITEM NAME: DELETE

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

DELETE_RECORD;

BLOCK NAME: MARK

ITEM NAME: PREVIOUS

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

PREVIOUS_RECORD;

BLOCK NAME: MARK

ITEM NAME: NEXT

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

NEXT_RECORD;
BLOCK NAME: MARK

ITEM NAME: FIRST

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

FIRST_RECORD;

BLOCK NAME: MARK

ITEM NAME: LAST

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

LAST_RECORD;

BLOCK NAME: MARK

ITEM NAME: EXECUTE

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

EXECUTE_RECORD;
BLOCK NAME: MARK

ITEM NAME: SAVE

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

SAVE_RECORD;

BLOCK NAME: MARK

ITEM NAME: TOTAL

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

TOTAL_RECORD;

: mark.average := :mark.total/2.0;

Go_item(‘mark.average’);

BLOCK NAME: MARK

ITEM NAME: TOTAL

ITEM TYPE: PUSH BUTTON

TRIGGER TYPE: ITEM LEVEL

TRIGGER NAME: WHEN_MOUSE_CLICK

AVERAGE_RECORD;
If(:mark.m1>50.00 and :mark2.m2>50.00) then

:mark.result := ‘PASS’;

ELSE

:mark.result :=’FAIL’;

End if;

Go_item(‘mark.result’);

Result:

Thus the Mark sheet Process has been executed using forms.

You might also like