Ex. No. 1 Date : Aim : Write a Java program to Implementation of TCP Sockets Program: tcpclient.java import java.io.

*; import java.net.*; class tcpclient { public static void main(String s[]) throws Exception { Socket soc=new Socket(InetAddress.getLocalHost(),5000); OutputStream os=soc.getOutputStream(); DataOutputStream dos=new DataOutputStream(os); InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(isr); InputStream is=soc.getInputStream(); DataInputStream dis=new DataInputStream(is); while(true) { System.out.println("Send : ");

Implementation of TCP Using Sockets

4

dos.writeUTF(br.readLine()); System.out.println("Received: "+dis.readUTF(dis)); } } } tcpserver.java import java.io.*; import java.net.*; class tcpserver { public static void main(String s[]) throws Exception { ServerSocket sersoc=new ServerSocket(5000); Socket soc=sersoc.accept(); InputStream is=soc.getInputStream(); DataInputStream dis=new DataInputStream(is); OutputStream os=soc.getOutputStream(); DataOutputStream dos=new DataOutputStream(os); InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(isr); while(true) { System.out.println("Received: "+dis.readUTF(dis)); System.out.println("Send }}}
5

: ");

dos.writeUTF(br.readLine());

Output : tcp server: C:\Program Files\Java\jdk1.6.0\bin>javac tcpserver.java C:\Program Files\Java\jdk1.6.0\bin>java tcpserver Received: mohamed Send Sathak :

tcp client:

C:\Program Files\Java\jdk1.6.0\bin>javac tcpclient.java C:\Program Files\Java\jdk1.6.0\bin>java tcpclient Send : mohamed Received: sathak Send :

Result : Thus the given java program was executed and output was verified.

6

Ex. No. 2 Date : Aim : Write a Java program to Implementation of file transfer Program: ftpclient.java import java.io.*; import java.net.*; public class ftpc { public static int serport=1666; public static int clientport=1999; public static DatagramSocket dss; public static byte buff[]=new byte[1024]; public static byte buff1[]= new byte[5000]; public static DatagramPacket dp,dp1; public static void client() throws Exception { int pos=0; String msg=" "; System.out.println("Client started"); while(true) {

Implementation of File Transfer

7

int c=System.in.read(); switch(c) { case '1': System.out.println("Client quits"); return; case '\n': String bye=new String(buff); InetAddress addr=InetAddress.getByName("localhost"); System.out.println(addr); while(true) { dss.send(new DatagramPacket(buff,pos,addr,serport)); dp1=new DatagramPacket(buff1,buff1.length); dss.receive(dp1); System.out.println("File Length is"+dp1.getLength()); if(dp1.getLength()>1) { for(int j=0;j<dp1.getLength();j++) { msg+=(char)buff1[j]; } System.out.println(msg); } else System.out.println("\nFile not found..."); pos=0;
8

default: buff[pos++]=(byte)c. public static DatagramSocket dss. } case '\r': break.net. } } } public static void main(String args[]) throws Exception { dss=new DatagramSocket(clientport). } } ftpserver. public static byte buff1[]=new byte[5000]. public class ftpserver { public static int serport=1666.*. 9 . public static int clientport=1999.io.java import java.break. client().*. public static byte buff[]=new byte[1024]. import java.

public static void server() throws Exception { InetAddress addr=InetAddress.out.clientport)). for(int i=0. dss.length). InputStream fis= new FileInputStream(str).send(new DatagramPacket(buff1.getByName("localhost").receive(dp).println(size).exit(0).size. System.buff. System.i++) buff[i]=(byte)fis.public static DatagramPacket dp. } catch(FileNotFoundException fe) { 10 . String str=new String(dp. dss.println("Filename server received "+str).getData().dp.println(addr).addr.read().0.out. int size=fis.out.dp1.i<size.getLength()).out.available(). } System. if(str. while(true) { try { DatagramPacket dp=new DatagramPacket (buff. System.equals("bye")) { System.println("Server quits").

clientport)).0.addr.err. dss. server(). } } } public static void main(String args[])throws Exception { System. dss=new DatagramSocket(serport).println(fe).send(new DatagramPacket(buff1.out.println("Server started"). } } 11 .System.

0.0\bin>java ftpclient Client started murali.0\bin>javac ftpclient.6.0\bin>javac ftpserver.txt localhost/127. 12 .1 File Length is 9 ftp server: C:\Program Files\Java\jdk1.0.java C:\Program Files\Java\jdk1.Output : ftp client: C:\Program Files\Java\jdk1.6.0.txt 9 Result : Thus the given java program was executed and output was verified.0.0\bin>java ftpserver Server started localhost/127.6.1 Filename server received murali.6.java C:\Program Files\Java\jdk1.

length>0)toName=args[0].receiverPort=ioPort. byte sendBuffer[]=new byte[65535]. if(args. DatagramPacket sendPacket=new DatagramPacket(sendBuffer. No. else toName="localhost". public class chat { public static void main(String args[])throws Exception { DatagramSocket ioSocket. int ioPort=111. BufferedReader in=new BufferedReader(new InputStreamReader(System. import java.io. Implementation of Chat Application 13 . 3 Date : Aim : Write a Java program to Implementation of chat application Program: chat.Ex. if(toName.*. String toName="localhost". String userIn.java import java.equals("localhost")) receiverPort=222.128).*.net.in)).

receiverPort=111.getBytes().sendBuffer.exit(0). new receiver(ioSocket).out. } System.readLine())!=null) { sendBuffer=userIn.Ctrl Z to quit").try { ioSocket=new DatagramSocket(ioPort). while((userIn=in.InetAddress.println("Exception:"+e). } catch(Exception e ) { System.length. ioPort=222. ioSocket=new DatagramSocket(ioPort).rec eiverPort).println("chat on port"+ioPort+".getByName(toName). sendPacket=new DatagramPacket(sendBuffer. } } class receiver implements Runnable { 14 . } System.out. ioSocket.send(sendPacket).

receiver(DatagramSocket rsSocket) { this.getData(). } catch(Exception e) { } System. while(true) { try { rsSocket.out.println("Received:"+new String(receivePacket.rsSocket=rsSocket.128).out.getLength())). new Thread(this). byte receiveBuffer[]=new byte[65535].start().receive(receivePacket). } } } 15 .0.receivePacket. } public void run() { System.println("Calling run"). DatagramPacket receivePacket=new DatagramPacket(receiveBuffer.DatagramSocket rsSocket.

java C:\Program Files\Java\jdk1.0\bin>javac chat. 16 .0\bin>java chat chat on port111.Ctrl Z to quit Calling run aaaaa Received:bbbbb ccccc Received:ddddd Result : Thus the given java program was executed and output was verified.Ctrl Z to quit Calling run Received:aaaaa bbbbb Received:ccccc ddddd Port 222: C:\Program Files\Java\jdk1.6.6.Output : Port 111: C:\Program Files\Java\jdk1.0\bin>javac chat.0\bin>java chat chat on port222.6.6.java C:\Program Files\Java\jdk1.

System. InputStreamReader isr=new InputStreamReader(System.lang. Simulation of Routing Protocols 17 . n1=br.j. import java. int[][] a=new int[100][100]. String s1. 4 Date : Aim : Write a Java program to Implementation of Routing Protocols Program: routing. No.k. int[][] b=new int[100][100].io.*.println("enter the number of nodes\n"). n=Integer.parseInt(n1).readLine(). class routing { public static void main(String args[])throws IOException { int n.*. BufferedReader br=new BufferedReader(isr).java import java.out.Ex.i. String n1.in).

j<n.j++) { System.i++) { for(j=0.println("\n\n").i++) { System.InputStreamReader isr1=new InputStreamReader(System. } System.k<n. } for(i=0.out.i<n. for(j=0.j++) { System.println("\n").print(a[i][j]+" ").out.k++) { for(i=0.i++) { 18 . for(i=0. } } for(k=0. s1=br1.out.j<n.readLine().out.parseInt(s1).i<n.in).i<n. BufferedReader br1=new BufferedReader(isr). a[i][j]=Integer.println("\n Enter the distance between the host "+(i+1)+" "+(j+1)+":").

19 .i<n.j++) { System.j++) { if(a[i][j]>a[i][k]+a[k][j]) a[i][j]=a[i][k]+a[k][j].println("\n the output matrix is:\n").for(j=0. } } System.j<n.out.out. if(i==j) b[i][j]=0.i<n.out. System.i++) { for(j=0.j<n.print(" ").out. for(j=0.j<n. for(i=0. } } } for(i=0.i++) { System.j++) { b[i][j]=a[i][j].println("\n").print(b[i][j]).

java C:\Program Files\Java\jdk1.} } } } Output : C:\Program Files\Java\jdk1.6.0\bin>java routing enter the number of nodes 3 Enter the distance between the host 1 1 Enter the distance between the host 1 2 Enter the distance between the host 1 3 :2 :4 :6 Enter the distance between the host 2 1 Enter the distance between the host 2 2 Enter the distance between the host 2 3 :8 : 10 : 12 20 .0\bin>javac routing.6.

21 .Enter the distance between the host 3 1 Enter the distance between the host 3 2 Enter the distance between the host 3 3 : 14 : 16 : 18 2 8 14 4 10 16 6 12 18 the output matrix is: 0 8 14 4 0 16 6 12 0 Result : Thus the given java program was executed and output was verified.

Table created. remark varchar2(10) . SQL> create table msec_course_inf ( course_id number(4) primary key.Transaction Control Language Study of All SQL Commands Codings: CREATE TABLE: SQL> create table msec_student_inf ( s_roll_no course_id contact_inf varchar2(15) primary key . course_name varchar2(30) not null .Data Definition Language 2. No.Ex. remark varchar2(100)).Data Manipulation Language 3. course_duration varchar2(30). address_inf varchar2(100)). Table created. 22 . number(4) . batch_inf varchar2(100) . student_name varchar2(100) not null. univ_regulation varchar2(100) . 5 Date : Aim : Study of all SQL Commands 1. varchar2(100) .

dept d WHERE e.deptno View created ALTER TABLE: SQL>alter table msec_student_inf modify batch_inf varchar2(50) Table altered. d.CREATE INDEX: SQL> CREATE INDEX emp_idx1 ON emp (ename. 23 .empno. Index dropped.ename.deptno. DROP INDEX: SQL>DROP INDEX emp_idx1. CREATE VIEW: SQL>CREATE VIEW EMP_DEPT_VIEW AS SELECT e.deptno = d.loc FROM emp e. e. d. job). Index created.

'2010-2012'.E.-------.'REGULAR COURSE'). CSE'. 1 row created.'ANNA UNIVERSITY OF TECHNOLOGY MADURAI R2010'.-----------NOT NULL VARCHAR2(15) NOT NULL VARCHAR2(100) NUMBER(4) VARCHAR2(50) VARCHAR2(100) VARCHAR2(100) VARCHAR2(100) 24 .'M.DESC COMMAND: SQL> desc msec_student_inf Name S_ROLL_NO STUDENT_NAME COURSE_ID BATCH_INF ADDRESS_INF CONTACT_INF REMARK INSERT COMMAND: SQL>insert into msec_course_inf Values (1. Null? Type ----------------------------------------------------.

-------5 COURSE_NAME -----------------------M.E.B. SELECT CLAUSE: SQL>SELECT COURSE_ID.A. CSE B.E. SQL>SAVEPOINT SP5. SQL>ROLLBACK TO SAVEPOINT sp5.COURSE_DURATION FROM MSEC_COURSE_INF WHERE COURSE_ID = 5.TECH IT M.COURSE_NAME. 25 COURSE_DURATION -----------------------------2010-2012 .A.COMMIT/SAVEPOINT/ROLLBACK TRANSACTION COMMAND: SQL>COMMIT. CSE B. COURSE_ID ---------------1 2 3 4 5 COURSE_NAME ---------------------M. COURSE_DURATION -----------------------------2010-2012 2010-2014 2010-2014 2010-2013 2010-2012 SQL>SELECT COURSE_ID. M.A.C.COURSE_NAME.B.COURSE_DURATION FROM MSEC_COURSE_INF. COURSE_ID ----------.

M.TECH IT M.TECH IT M. CSE B.COURSE_DURATION FROM MSEC_COURSE_INF WHERE COURSE_ID BETWEEN 2 AND 5 COURSE_ID ----------------2 3 4 5 COURSE_NAME -----------------------------B.COURSE_NAME. COURSE_DURATION -----------------------------2010-2014 2010-2014 2010-2013 2010-2012 ORDER BY CLAUSE: SQL>SELECT * FROM emp WHERE job = 'SALESMAN' ORDER BY comm DESC.E.COURSE_DURATION FROM MSEC_COURSE_INF WHERE COURSE_ID < 5.A.SQL>SELECT COURSE_ID.A.COURSE_NAME.C. COURSE_DURATION -----------------------------2010-2012 2010-2014 2010-2014 2010-2013 SQL>SELECT COURSE_ID.A. COURSE_ID ----------------1 2 3 4 COURSE_NAME -----------------------------M. CSE B.C. 26 .B.E. CSE B.E.

job. job. dept. 27 . MAX.deptno. MIN(sal). dept.deptno. dname FROM emp.AGGREGATE FUNCTION (MIN. dept WHERE emp. HAVING): SQL> SELECT deptno. dname FROM emp. DEPTNO --------20 30 JOIN CONDITION: SQL> SELECT ename. ENAME ---------SMITH ADAMS JAMES MILLER JOB --------CLERK CLERK CLERK CLERK DEPTNO DNAME ------------------------20 RESEARCH 20 RESEARCH 30 SALES 10 ACCOUNTING MIN(SAL) --------800 950 MAX(SAL) --------1100 950 OUTER JOIN CONDITION: SQL>SELECT ename.deptno = dept. GROUP BY. dept WHERE emp. MAX (sal) FROM emp WHERE job = 'CLERK' GROUP BY deptno HAVING MIN(sal) < 1000.deptno.deptno (+) = dept.deptno AND job = 'CLERK'.

UPDATE RECORD: SQL>update msec_course_inf set univ_regulation='ANNA UNIVERSITY TIRUCHIRAPPALLI' where course_id=5 1 row updated.ENAME ---------CLARK KING MILLER SMITH ADAMS FORD SCOTT JONES ALLEN BLAKE MARTIN JAMES TURNER WARD JOB --------MANAGER PRESIDENT CLERK CLERK CLERK ANALYST ANALYST MANAGER SALESMAN MANAGER SALESMAN CLERK SALESMAN SALESMAN DEPTNO DNAME ----------------------10 ACCOUNTING 10 ACCOUNTING 10 ACCOUNTING 20 RESEARCH 20 RESEARCH 20 RESEARCH 20 RESEARCH 20 RESEARCH 30 SALES 30 SALES 30 SALES 30 SALES 30 SALES 30 SALES 15 rows selected. 28 .

CSE B.A. COURSE_ID ----------------2 3 4 5 COURSE_NAME ---------------------B.TECH IT M. M.B.TECH IT M. UNIV_REGULATION ---------------------------------------ANNA UNIV OF TECH MADURAI R2010 ANNA UNIV OF TECH MADURAI R2010 ANNA UNIV OF TECH MADURAI R2010 ANNA UNIV OF TECHN MADURAI R2010 ANNA UNIVERSITY . M.E.B.A.E. UNIV_REGULATION ---------------------------------------ANNA UNIV OF TECH MADURAI R2010 ANNA UNIV OF TECH MADURAI R2010 ANNA UNIV OF TECHN MADURAI R2010 ANNA UNIVERSITY . CSE B. CSE B.A. 1 rows deleted.COURSE_ID ----------------1 2 3 4 5 COURSE_NAME ---------------------M.C.E. 29 .C.A.TIRUCHIRAPPALLI R2009 Result : Thus the given SQL commands were studied and output was verified.TIRUCHIRAPPALLI R2009 DELETE CLAUSE: SQL>delete from msec_course_inf where course_id=1.

into tables. Normalization avoids duplication of data. Implementing The Concept of Normalization 30 . Normalization: Normalization is a method for organizing data elements in a database. No.2NF and 3NF). From the given data elements for customer Invoices. Consider the following invoice information that was maintained in Excel.Ex. 6 Date : Aim : Implement the concept of Normalization (1NF.

FIRST NORMAL FORM :  No Repeating Elements Or Group Of Elements  Confirms Automicity For Data Elements And Identification Of Primary Keys Thus the above data elements can be represented as follows. we can identify the required tables from the given set of data elements by which we can implement coding.Here if we analyze the spread sheet. INVOICES INVOICE_NO (PK) INVOICE_DATE CUST_ID CUST_NAME CUST_ADDR CUST_CITY CUST_STATE ITEM_ID (PK) ITEM_DESC ITEM_QTY ITEM_PRICE TOTAL_PRICE 31 . By implement the normalization. which has the data redundancy for customer information. using 1NF. rows 2.3 and 4 are representing the data for invoice no=125.

Item Table Can Be Further Seperated As Item Information And Put Into Separate Table 32 .SECOND NORMAL FORM:  No Partial Dependencies On A Concatenated Key(S) PHASE-I: Invoice Information And Invoice Item Information Can Be Seperated Into Tables PHASE –II: Invoice.

Codings: SQL> CREATE TABLE INVOICES 2 ( 33 .THIRD NORMAL FORM:  No Dependencies On Non-Key Attributes Here the problem of repeating customer information has to be separated in a table because if the customer places more number of orders then these information will be entered again and again.

4 INVOICE_DATE DATE. SQL> CREATE TABLE INVOICE_ITEM 2 ( 3 ITEM_ID NUMBER(6) PRIMARY KEY.3 INVOICE_NO NUMBER(6) PRIMARY KEY. 6* ITEM_PRICE NUMBER(10. 5 CUST_ID NUMBER(6)). SQL> CREATE TABLE CUSTOMER 2 ( 34 . 5 ITEM_DESC VARCHAR2(50) UNIQUE. TABLE CREATED.2)). 4 INVOICE_NO NUMBER(6). TABLE CREATED.

7 CUST_STATE VARCHAR2(50)). TABLE CREATED. TABLE CREATED.2)). SQL> CREATE TABLE ITEMS 2 ( 3 ITEM_ID NUMBER(6) PRIMARY KEY. No. 4 CUST_NAME VARCHAR2(50) UNIQUE. 4 ITEM_DESC VARCHAR2(50) UNIQUE. Result : Thus the given normalization concepts was executed and output was verified. 5 CUST_ADDR VARCHAR2(50). 6 CUST_CITY VARCHAR2(50).3 CUST_ID NUMBER(6) PRIMARY KEY. Ex. 5 ITEM_PRICE NUMBER(10. 7 Date : Aim : 35 Develop A Package To Maintain Its Customer Details .

5000 Current a/c NRE a/c Rs. Customer Account number is system generated and unique 2.Develop a Package for Bank to maintain its Customers detail Customer Account Opening Form: Business Rules: 1.100 3. if trans_type=withdraw then amount will be debited from main balance. Transaction date is system date 3. Table Creation : Customer Information : create table bank_cust_inf ( 36 . All other deposits through transaction only Transaction Table: 1. Transaction is made upon the user input values for transaction type and transaction amount 4.1000 Rs. Transaction id is system generated 2. Set current bal = opening balance at the opening time 4. Opening balance is set according to the account type as Savings bank a/c Rs. if trans_type=deposit then amount will be credited 5.25000 Recurring depositRs.

varchar2(50) not null. open_date varchar2(10)). trans_date varchar2(10). trans_type number(1).2). varchar2(50) not null. trans_amt number(15. current_bal number(15. varchar2(50) not null. new_bal remark number(15. avl_bal number(15. number(15. varchar2(50)). varchar2(50) not null.2).2). Form design time codings: Form level triggers: When-tabpage-changed: 37 .2). cust_acno number(10). account_type number(1). Bank Transaction Information : create table bank_trans ( trans_slno number(8) primary key.2).cust_acno cust_name cust_addr cust_phno cust_mail open_bal number(10) primary key.

else :BANK_CUST_INF.IF :SYSTEM. TRANSACTION TABLE CODINGS: BEGIN SELECT CURRENT_BAL INTO :BANK_TRANS.TAB_NEW_PAGE='TRANS' THEN GO_BLOCK('BANK_CUST_INF1').CUST_ACNO from BANK_CUST_INF. if n>0 then select max(CUST_ACNO)+1 into :BANK_CUST_INF. ELSIF :SYSTEM. end if. end. END IF. EXECUTE_QUERY. EXECUTE_QUERY.TAB_NEW_PAGE='CUST' THEN GO_BLOCK('BANK_CUST_INF').CUST_ACNO:=1001. insert_record.AVL_BAL FROM BANK_CUST_INF 38 . begin select count(*) into n from BANK_CUST_INF. ON-INSERT on customer account opening: declare n number.

CUST_ACNO.AVL_BAL :BANK_TRANS.TRANS_AMT :BANK_CUST_INF.TRANS_AMT:=:BANK_TRANS. IF :BANK_TRANS. IF :BANK_TRANS.WHERE CUST_ACNO=:BANK_CUST_INF1.NEW_BAL:=:BANK_TRANS.NEW_BAL:=:BANK_TRANS. END IF.TRANS_TYPE=1 THEN : BANK_TRANS.NEW_BAL WHERE CUST_ACNO=:BANK_CUST_INF1.TRANS_AMT. END.NEW_BAL:=:BANK_TRANS.TRA NS_AMT.OPEN_BAL THEN :BANK_TRANS.NEW_BAL < :BANK_CUST_INF. WHEN OTHERS THEN NULL.CUST_ACNO. EXCEPTION WHEN NO_DATA_FOUND THEN NULL. END IF.TRANS_TYPE=2 THEN :BANK_TRANS.OPEN_BAL. UPDATE BANK_CUST_INF SET CURRENT_BAL = :BANK_TRANS.TRANS_AMT.AVL_BAL :BANK_TRANS. :BANK_TRANS. ELSIF :BANK_TRANS. 39 .AVL_BAL+:BANK_TRANS.

DSP_AC_TYPE:='Current Account'.account_type=4 then :bank_cust_inf1.DSP_AC_TYPE:='Savings Bank Account'.account_type=1 then :bank_cust_inf1.DSP_AC_TYPE:='Recurring Deposit'. Run time Screen Shot(s) – Customer Account Opening Form: 40 . end if. elsif :bank_cust_inf1.account_type=2 then :bank_cust_inf1.account_type=3 then :bank_cust_inf1.POST-QUERY ON TRANSACTION TABLE: if :bank_cust_inf1. elsif :bank_cust_inf1. elsif :bank_cust_inf1.DSP_AC_TYPE:='NRE/NRO Savings Account'.

Customer Account Transaction Screen: Result : Thus the given package was executed and output was verified. No. 8 41 . Ex.

job title id is lookup field from concerned sub tables 3.2). 42 . basic_sal number(10.2). job_title_id number(2). Over time pay = 1.5 time of Basic pay / hr Table creation: Employee information: SQL> create table employee_inf ( empno number(5) primary key.2). 4.2). Net salary is calculated field as Net salary= (Basic salary+Overtimepay+Bouns)-Deduction. bonus number(9. empname varchar2(100) not null.Date : Develop A Package For The Payroll of A Company Aim : Develop a package for the Pay-Roll of a Company Employee Detail: 1. Deptno. deptno number(2). over_time number(9. deduction number(9. Empno is system generated and unique 2. join_date varchar2(10) not null. net_salary number(9.2).

Table created. Employee department information: create table emp_dept ( deptno number(4) primary key. Employee overtime information: SQL> 43 . varchar2(100) Table created. Table created. Employee job title informaton: create table emp_job_title ( job_title_id number(2) primary key.remark ). job_desc varchar2(50) not null ). dname varchar2(50) unique ).

'MANAGER'). SQL> SQL> INSERT INTO emp_job_title 2 VALUES (1. Table created. ot_pay number(10. ot_hrs number(2).create table emp_overtime ( empno number(5). SQL> INSERT INTO emp_dept 2 VALUES (1. ot_date varchar2(10). Form Design Codings: Form level triggers – WHEN-NEW-FORM-INSTANCE: 44 . ot_amt number(10.2) ).2). 1 row created.'ADMIN'). 1 row created.

MAXIMIZE). END.window_state.'RG_TITLE'). WHEN-TAB-PAGE-CHANGED: IF :SYSTEM. POPULATE_LIST('EMPLOYEE_INF.TAB_NEW_PAGE='EMP' THEN GO_BLOCK('EMPLOYEE_INF'). EXECUTE_QUERY. declare n number. 45 .TAB_NEW_PAGE='JOB' THEN GO_BLOCK('EMP_JOB_TITLE').set_window_property(forms_mdi_window. set_window_property('MAIN'. POPULATE_LIST('EMPLOYEE_INF.window_state.MAXIMIZE).TAB_NEW_PAGE='DEPT' THEN GO_BLOCK('EMP_DEPT'). ELSIF :SYSTEM.TAB_NEW_PAGE='OT' THEN GO_BLOCK('EMPLOYEE_INF1').JOB_TITLE_ID'. ELSIF :SYSTEM.'RG_DEPT'). POPULATE_LIST('EMPLOYEE_INF.EMPNO'. begin n:=POPULATE_GROUP('RG_EMP'). EXECUTE_QUERY. n:=POPULATE_GROUP('RG_DEPT'). n:=POPULATE_GROUP('RG_TITLE'). ELSIF :SYSTEM.'RG_EMP').DEPTNO'. EXECUTE_QUERY.

EMPNO from else :EMPLOYEE_INF. end if.deduction. Field Level Triggers – KEY-NEXT-ITEM (all calculation fields): :EMPLOYEE_INF.EXECUTE_QUERY.bonus.over_time.basic_sal. begin select count(*) into n from EMPLOYEE_INF. END IF. end insert_record.0)+NVL(:EMPLOYEE_INF. Employee overtime pay per hour based on basic salary: :EMP_OVERTIME.5). if n>0 then select max(EMPNO)+1 into :EMPLOYEE_INF.0)+ NVL(:EMPLOYEE_INF. BLOCK LEVEL TRIGGERS – ON INSERT: declare n number.basic_sal*:EMP_OVERTIME.ot_hrs)/208)*1.2).NET_SALARY:= (NVL(:EMPLOYEE_INF.EMPNO:=1001.ot_pay:= ROUND((((:EMPLOYEE_INF1. employee_inf.0)). 46 .0))(NVL(:EMPLOYEE_INF.

ot_amt:=:EMP_OVERTIME. Screen Shot: Search Module : 47 .ot_hrs*:EMP_OVERTIME.ot_pay.: EMP_OVERTIME.

Overtime Calculation : Monthly Pay-Roll Preperation : 48 .

49 .Result : Thus the given package was executed and output was verified.

Delete operation is not allowed until all transaction entries are cleared. No. 4. to maintain integrity constraints. purchase order initiated 5. 9 Date : Implement The Inventory Control System With A Reorder Level Aim : Implement the Inventory Control System with Re-order level Inventory Master: Business Rules: 1. no transaction could be modified from transaction screen 50 . then check for re-order level 3. allow transaction 4. Inventory Transaction: 1. if the item is available. Min Qty = 10 and Max Qty = 100 2. New item can be inserted through this module but update through transaction only 3. Check for the item availability 2. if the item can be issued. Over stock level condition : if avl_qty>=max_qty. Re-Order level condition : if avl_qty<= min_qty. update master file with the current avl qty 5.Ex.

number(3). trans_date varchar2(10) default to_char(sysdate.Create table: Master Information: create table inventory_master ( item_code number(5) primary key. item_name varchar2(30) not null. trans_amt number(7. item_code number(5). Transaction Information create table inventory_trans ( trans_slno number(8) primary key. 51 . number(5). avl_qty min_qty max_qty supp_inf remark number(5). varchar2(100)). trans_qty number(5).2). remark varchar2(100)).2). unit_price number(7. varchar2(100).'dd/mm/yyyy').

MAXIMIZE).'RG_ITEM').MIN_QTY:=10.window_state.window_state.TAB_NEW_PAGE='MASTER' THEN GO_BLOCK('INVENTORY_MASTER'). ELSIF :SYSTEM. END IF.MAX_QTY:=100. IF :SYSTEM. :INVENTORY_MASTER. END IF.Design time Codings: Form level triggers – when new form instance: set_window_property(forms_mdi_window. END. 52 . When tab page changed: IF :SYSTEM. set_window_property('MAIN'. declare n number. POPULATE_LIST('INVENTORY_TRANS.ITEM_CODE'.TAB_NEW_PAGE='TRANS' THEN GO_BLOCK('INVENTORY_TRANS'). EXECUTE_QUERY.MODE='NORMAL' THEN :INVENTORY_MASTER.MAXIMIZE). begin n:=POPULATE_GROUP('RG_ITEM'). EXECUTE_QUERY.

when others then null.trans_qty*:inventory_trans. else :inventory_master. end if.:inventory_trans.trans_amt:=:inventory_trans.item_code from inventory_master. exception when no_data_found then null. begin select count(*) into n from inventory_master.avl_qty into :inventory_trans. :inventory_trans.item_code. insert_record.dsp_up. Transaction module codings: begin select unit_price. if n>0 then select max(item_code)+1 into :inventory_master. end.dsp_up.dsp_avl from inventory_master where item_code=:inventory_trans.item_code:=1.On Insert trigger on inventory master (item code): declare n number. end. 53 .

end. delete_record. :inventory_trans.TRANS_QTY WHERE ITEM_CODE=:INVENTORY_TRANS.dsp_avl from inventory_master where item_code = :inventory_trans.ITEM_CODE.item_code. exception when no_data_found then null. Post Query: begin select unit_price. Post insert: UPDATE INVENTORY_MASTER SET AVL_QTY=AVL_QTY-:INVENTORY_TRANS. 54 .dsp_up.On delete entry UPDATE INVENTORY_MASTER SET AVL_QTY=AVL_QTY+:INVENTORY_TRANS. when others then null.TRANS_QTY WHERE ITEM_CODE=:INVENTORY_TRANS.avl_Qty into :inventory_trans.ITEM_CODE.

Runtime Screen Shot(s): Result : Thus the given package was executed and output was verified. 55 .