CONTENTS

S.No. Date Name of the Experiment Page No. Marks Signature Obtained

1 2 3 4 5 6 7 8 9 10 11

Data Definition Language and Data Manipulation Language Database Language with Constraints Cursors Triggers Functions Procedures Embedded SQL Entity Relationship Model Payroll Process Banking System Library Information System

1 7 10 15 19 23 27 36 41 47 53

Average

=

Ex No. : 1

Aim: To write SQL Queries using Data Definition Language and Data Manipulation Language

DATA DEFINITION LANGUAGE
CREATE Syntax: SQL> create table <table_name> ( col_name1, datatype(size),………..); SQL> create table <table_name> as select * from <source_table_name> Queries: SQL> create table employee(emp_id number(5),emp_name varchar2(10), salary number(6)); Table created. SQL> desc employee; Name Null? Type ----------------------------------------- ---------- ---------------------------EMP_ID NUMBER(5) EMP_NAME VARCHAR2(10) SALARY NUMBER(6) SQL> create table emp as select * from employee; Table created. SQL> desc emp; Name Null? Type ----------------------------------------- ---------- ---------------------------EMP_ID NUMBER(5) EMP_NAME VARCHAR2(10) SALARY NUMBER(6)

ALTER: Syntax: SQL> alter table <table_name> add( new col_name1, datatype(size),………..); Queries: SQL> alter table employee add(experience number(2)); Table altered. SQL> desc employee; Name Null? Type ----------------------------------------- ---------- ---------------------------EMP_ID NUMBER(5) EMP_NAME VARCHAR2(10) SALARY NUMBER(6) EXPERIENCE NUMBER(2)

TRUNCATE: Syntax: SQL> truncate table <table_name>; Queries: SQL> truncate table employee; Table truncated. SQL> desc employee; Name Null? Type ----------------------------------------- ---------- ---------------------------EMP_ID NUMBER(5) EMP_NAME VARCHAR2(10) SALARY NUMBER(6) EXPERIENCE NUMBER(2) SQL> select * from employee; no rows selected

Queries: SQL> insert into employee values(1006.&sal).'Ram'. SQL> select * from employee.……). SQL> desc employee. SQL> insert into <table_name> values(‘&col_name1’.15000) 1 row created. SQL> insert into employee values(&emp_no. Enter value for emp_no: 1007 Enter value for name: ranjith Enter value for sal: 15000 old 1: insert into employee values(&emp_no. Queries: SQL> drop table employee.'&name'. Table dropped.DROP: Syntax: SQL>drop table <table_name>.------------1006 Ram 8500 1007 Ranjith 15000 SQL> .'ranjith'. 1 row created.'&name'.&sal) new 1: insert into employee values(1007.……).--------------------. ERROR: ORA-04043: object employee does not exist DATA MANIPULATION LANGUAGE INSERT: Syntax: SQL> insert into <table_name> values(val1. EMP_ID EMP_NAME SALARY ------------.8500).

Queries: SQL> select * from employee.SELECT: Syntax: SQL> select *from <table_name>. Enter value for sal: 9200 Enter value for emp_id: 1006 old 1: update employee set experience=&exp where emp_id=&emp_id new 1: update employee set experience=5 where emp_id=1006 1 row updated. SQL> select * from employee.------------1006 Ram 9200 1007 Ranjith 15000 SQL> .------------1006 Ram 8500 1007 Ranjith 15000 SQL> UPDATE: Syntax: SQL> update <table_name> set col_name1=value where col_name2=value.--------------------.--------------------. EMP_ID EMP_NAME SALARY ------------. EMP_ID EMP_NAME SALARY ------------. Queries: SQL> update employee set Salary=&sal where emp_id=&emp_id.

SQL> select * from employee. 1 row deleted.------------1006 Ram 9200 SQL> . EMP_ID EMP_NAME SALARY ------------.DELETE: Syntax: SQL> Delete from <table_name> where col_name=value. Queries: SQL> delete from employee where emp_id=1007.--------------------.

Contents Design Development Queries & Execution Viva Voce Record Total Max. Marks 20 20 20 20 20 100 Marks Obtained Result: .

….. SQL> create table <table_name>(col_name1 datatype(size).. primary key(col_name1.… ).….) ).) ). Name Null? Type ---------------.…. unique(col_name1.…. Table created..………. datatype(size). SQL> create table <table_name> (col_name1 datatype(size) not null. foreign key(col_name11. SQL> create table <table_name>(col_name1 datatype(size). primary key(id)).---------------------------- . name varchar2(10).……….…. : 2 Aim: To write SQL queries implementing constraints with DDL and DML Syntax: SQL> create table <table_name> ( col_name1..----------------.) as references <source_table_name>(col_name21.………). check(col_name1 between value1 and value2)).…. check(col_name1 in value)). SQL> create table <table_name> ( col_name11.……….. SQL> create table <table_name> ( col_name1..Ex No. check(col_name1 not in value)).... SQL> create table <table_name>(col_name1 datatype(size). datatype(size). datatype(size). SQL> desc sample.. Queries: SQL> create table sample(id number(5)...

----------------. Table created. check(id in 2000)). SQL> desc sample. Name Null? Type ---------------. . Table created. name varchar2(10). SQL> desc samp. foreign key(id) references sample(id)).---------------------------ID NUMBER(5) NAME VARCHAR2(10) SQL> create table samp (id number(5).----------------. Name Null? Type ---------------. unique(id)).----------------. name varchar2(10).---------------------------ID NOT NULL NUMBER(5) NAME VARCHAR2(10) SQL> create table sample (id number(5). check(id not in 2000)). SQL> create table sample (id number(5). Name Null? Type ---------------. check(id between 2000 and 3000)). name varchar2(10). Table created. SQL> create table sample (id number(5). name varchar2(10)). Table created.---------------------------ID NUMBER(5) NAME VARCHAR2(10) SQL> create table sample (id number(5) not null. Table created. name varchar2(10). name varchar2(10). Table created.ID NAME NOT NULL NUMBER(5) VARCHAR2(10) SQL> create table sample(id number(5). SQL> desc sample.

Marks 20 20 20 20 20 100 Marks Obtained .Contents Design Development Queries & Execution Viva Voce Record Total Max.

Result: Ex No. name varchar2(10). . : 3 Aim: To a write a PL/SQL program to implement cursors. For Creating Database: Algorithm: 1. primary key(ac_no)). Set "ac_no" as primary key for that table. balance number(5). SQL> insert into bank values(&ac_no. Queries: For creating database for “bank” SQL> create table bank (ac_no number(11). 2. "name" and "balance”.&balance). Create a database with SQL for "bank" table with attributes "ac_no".'&name'.

end. 7. 3.CURSORS Algorithm: For Deposit: 1. end loop. 3.ac_no=m.n number) as c number. loop fetch cur into c. / . close cursor and end the procedure Queries: For deposit: SQL> create or replace procedure deposit(m number. Declare a cursor named cur 4. begin open cur. cursor cur is select balance from scott. close cur. 2. 4. open the cursor and fetch the data into the variables 6. 6. get the balance into the cursor for the given account no 5. Declare two variables as number for ac_no and amount. Start the procedure named withdraw Declare 2 variables to get 2 integers Declare a cursor named cur get the balance into the cursor for the given account no open the cursor and fetch the data into the variables to update the current balance subtract the given amount to the existing balance exit loop when cursor fetches null value close cursor and end the procedure For withdraw: 1.bank where ac_no=m. update bank set balance=c+n where bank. 5. Start the procedure 2. to update the current balance add the given amount to the existing balance 7. 8. exit when cur%NOTFOUND.

ac_no=m. cursor cur is select balance from scott. end loop.---------------------------AC_NO NOT NULL NUMBER(11) NAME VARCHAR2(10) BALANCE NUMBER(5) Output: For deposit: SQL> select * from bank.500) . end.----------------6152004 SaravanaKumar.n number) as c number.------------------------. begin open cur.For Withdraw: SQL> create or replace procedure withdraw(m number. AC_NO NAME BALANCE ------------.R 7200 6152006 Saravanan.----------------. exit when cur%NOTFOUND.A 2500 SQL> exec deposit(6152004. update bank set balance=c-n where bank.bank where ac_no=m. / Database for the table “bank”: SQL> desc bank Name Null? Type ----------------------------------. close cur. loop fetch cur into c.S 2600 6152005 SathyaAnand.

S 2600 6152005 SathyaAnand.----------------6152004 SaravanaKumar. SQL> select * from bank.A 2500 SQL> . AC_NO NAME BALANCE -------------.S 3100 6152005 SathyaAnand. AC_NO NAME BALANCE -------------.A 2500 For Withdraw: SQL> select * from bank. AC_NO NAME BALANCE -------------.R 7200 6152006 Saravanan.R 7200 6152006 Saravanan. SQL> select * from bank.----------------6152004 SaravanaKumar.-----------------------.-----------------------.-----------------------.S 3100 6152005 SathyaAnand.R 7200 6152006 Saravanan.A 2500 SQL> exec withdraw(6152004.500).----------------6152004 SaravanaKumar.PL/SQL procedure successfully completed. PL/SQL procedure successfully completed.

.

Marks 20 20 20 20 20 100 Marks Obtained Result: Ex No. Create a database with SQL for "bank" table with attributes "ac_no".Contents Design Development Queries & Execution Viva Voce Record Total Max. 4. : 4 Aim: To a write a PL/SQL program to implement triggers. Queries: For creating database for “bank” . For Creating Database: Algorithm: 3. "name" and "balance”. Set "ac_no" as primary key for that table.

Create a trigger 2. 3. TRIGGERS For Negative Balance: Algorithm: 1. Use row level trigger using for each row 4. report an error 5.&balance).balance<0 then raise_application_error(-20003. Use row level trigger using for each row 4. While inserting or updating if balance is in negative. balance number(5). End trigger Queries: SQL> create or replace trigger trig before insert or update of balance on scott. report an error 5.bank for each row begin if :new. SQL> insert into bank values(&ac_no. end.'&name'. Declare a trigger trig that fires before insert or update of balance from table “bank”. Create a trigger 2.'Negative balance not allowed'). name varchar2(10). primary key(ac_no)). end if. Declare a trigger trig that fires before insert or update of balance from table “bank”.bank . / For Low balance: Algorithm: 1. 3. While inserting or updating if balance is less than 450. End trigger Queries: SQL> create or replace trigger mytrig before insert or update of balance on scott.SQL> create table bank (ac_no number(11).

---------------------------AC_NO NOT NULL NUMBER(11) NAME VARCHAR2(10) BALANCE NUMBER(5) Output: SQL> update bank set balance=200 where ac_no=6152004. line 3 ORA-04088: error during execution of trigger 'SCOTT.MYTRIG' SQL> update bank set balance=2600 where ac_no=6152004. end.MYTRIG". 1 row updated.----------------.balance<450 then raise_application_error(-20003. SQL> . update bank set balance=-200 where ac_no=6152004 * ERROR at line 1: ORA-20003: Negative balance not allowed ORA-06512: at "SCOTT.for each row begin if :new. update bank set balance=200 where ac_no=6152004 * ERROR at line 1: ORA-20003: Balance low ORA-06512: at "SCOTT.’Balance low'). end if.TRIG". / Database for the table “bank”: SQL> desc bank Name Null? Type ----------------------------------.TRIG' SQL> update bank set balance=-200 where ac_no=6152004. line 3 ORA-04088: error during execution of trigger 'SCOTT.

.

. Marks 20 20 20 20 20 100 Marks Obtained Result: Ex No. : 5 Aim: To a write a PL/SQL program to find factorial of a number and first ‘n’ numbers of Fibonacci series using functions.Contents Design Development Queries & Execution Viva Voce Record Total Max.

2. T. end. T number. Queries: SQL> create or replace function fact(n in number) return number is begin If n=1 then return 1.put_line(‘THE FACTORIAL IS ‘||T). End if. / ii) FIBONACII SERIES Algorithm: 1.i) FACTORIAL Algorithm: 1. 3. If n=1 then return 1. Else Return n*fact(n-1). 6. 7. 5. If n>1 then return n*fact(n-1). Execute the value of factorial using dbms_output. begin N:=&NO.put_line(). If n=1 then return 0. end. Create a function fib. 2. . Declare the variable N. Get the value of N. Create a function named as fact. 3. Declare the variables I and N. / SQL> declare N number. T:=fact(N). 4. Dbms_output. End of program.

4. 5. 6. 7.

If n=2 then return 1. If n>2 then return fib(n-1)+fib(n-2). Execute the series using dbms_output.put_line(). End of program.

Queries: SQL> create or replace function fib(n in number) return number is begin If n=1 then return 0; End if; If n=2 then return 1; Else Return fib(n-1)+fib(n-2); End if; end; / SQL> declare i number; n number; f number; begin N:=&NO; Dbms_output.put_line(‘FIBONACCI SERIES IS’); For I in 1..N Loop F:=fib(I); Dbms_output.put_line (F); End loop; end; /

Output: i) FACTORIAL Enter value for no: 5

old 5: N:=&NO; new 5: N:=5; THE FACTORIAL IS 120 ii) FIBONACII SERIES Enter value for no: 5 old 6: N:=&NO; new 6: N:=5; FIBONACCI SERIES IS 0 1 1 2 3

Contents Design Development Queries & Execution Viva Voce Record Total

Max. Marks 20 20 20 20 20 100

Marks Obtained

Result:

Create the procedure arith using SQL. end.put_line ('Subtraction value '||sub1). Declare two variables for performing arithmetic operations. b number(5):=&b. multiplication and division using the variables. mul1 number(5). mul1:=n1*n2. 3. 2. 5. i) ARITHMETIC OPERATIONS: Algorithm: 1. Print the result. n2 in number) as add1 number(5). Perform the operations addition. sub1:=n1-n2. : 6 Aim: To a write a PL/SQL program to perform arithmetic operations and to find square of a number using procedures.put_line ('Division value '||div1). Declare the variables for storing the result. dbms_output. Queries: SQL> create or replace procedure arith(n1 in number. begin arith (a. div1 number(5). dbms_output. subtraction. / .b). begin add1:=n1+n2. 4. dbms_output. sub1 number(5). div1:=n1/n2.put_line ('Multiplication value '||mul1).put_line ('Addition value '||add1). end.Ex No. / SQL> declare a number(5):=&a. dbms_output.

2.ii) SQUARE Of GIVEN NUMBER: Algorithm: 1. Perform the operation of squaring the given numbers using the variables. dbms_output.put_line('Square of a:'||b1). Display the result using dbms commands. b1:=res. 3. Create the procedure in SQL to find the square of given numbers. Queries: SQL> create or replace procedure sq(a1 in number) as b1 number. Declare the variables for performing the operations. res number. 5. / SQL> declare a number(5):=&a. 6. begin sq(a). Print the result. Declare the variables to store the result. end. begin res:=a1*a1. / . 4. end.

Addition value 24 Subtraction value 16 Multiplication value 80 Division value 5 ii) SQUARE Of GIVEN NUMBER: Enter value for a: 5 old 2: a number(5):=&a. Enter value for b: 4 old 3: b number(5):=&b.Output: i) ARITHMETIC OPERATIONS: Enter value for a: 20 old 2: a number(5):=&a. Square of a:25 . new 2: a number(5):=5. new 3: b number(5):=4. new 2: a number(5):=20.

Marks 20 20 20 20 20 100 Marks Obtained .Contents Design Development Queries & Execution Viva Voce Record Total Max.

Queries: For creating database for “bank” SQL> create table bank (ac_no number(11). "name" and "balance”. Create a database with SQL for "bank" table with attributes "ac_no".&balance). : 7 Aim: To write a java program to embedded SQL statement and execute the SQL queries.Result: Ex No.'&name'. For Creating Database: Algorithm: 5. For Java Programing: For INSERT: Algorithm: . Set "ac_no" as primary key for that table. SQL> insert into bank values(&ac_no. balance number(5). 6. name varchar2(10). primary key(ac_no)).

try { /*Method1 using jdbc-odbc*/ //Class.'"+str2+"'. Now insert the values into the table.str4. System. Display the results."+str3+".*. Connection con=DriverManager."). Establish the connection between jdbc and odbc using DriverManager.str2.getConnection("jdbc:oracle:oci8:scott/tiger@db9"). String str=new String().println("Enter the Name:").out. System.println("\n1 row inserted.JdbcOdbcDriver").GetConnection ().'"+str4+"')". System.io. import java.odbc.executeUpdate(str).jdbc.createStatement().out. str3=in.forName("sun. Statement stat=con.1.println("Enter the Ac_no:"). str2=in.*. str1=in.getConnection("jdbc:odbc:MyProj".readLine().in). System. //Connection con = DriverManager.out. System."tiger").OracleDriver()).jdbc. ResultSet result. 2."scott".registerDriver(new oracle.println("Enter the Balance:").readLine().out. str="insert into bank values ("+str1+".out.println("Enter the Ac_Type:"). /*Method2 using jdbc-oci*/ DriverManager. stat. str4=in. } catch(Exception e) . Program: import java. 3. String str1.sql.str3.readLine().readLine(). class Ins { public static void main(String a[]) throws IOException { DataInputStream in=new DataInputStream(System.

registerDriver(new oracle.println("\nAc_No\tName\t\t\tBalance\tAc_Type\n"). } } } For SELECT: Algorithm: 1. 4. String str1=new String(). Select the row(s) to be displayed.getString(2) + "\t\t" + result.createStatement()."tiger").sql. /*Method2 using jdbc-oci*/ DriverManager. class Sel { public static void main(String a[])throws IOException { ResultSet result.jdbc. Establish the connection between jdbc and odbc using DriverManager. Program: import java.io.*.getString(4)).forName("sun. result=stat. //Connection con=DriverManager. System.odbc.out. Insert the values into the table using SQL. System.out. import java. Display the results.next()) { System. Connection con=DriverManager.JdbcOdbcDriver"). str1="Select * from bank ".{ System.OracleDriver()).jdbc. Statement stat=con. while(result.getString(3) + "\t" + result.out.GetConnection (). 3. .*.println("-----------------------------------------------\n").executeQuery(str1). 2.out.println("\nError:"+e)."scott".getConnection("jdbc:oracle: oci8:scott/tiger@db9").println( result.getConnection("jdbc:odbc:MyProj".getString(1) + "\t" + result. try { /*Method1 using jdbc-odbc*/ //Class.

Insert the values into the table using SQL.*. Statement stat=con.registerDriver(new oracle.GetConnection ().out. . str1="delete from bank where ac_no="+str. String str.println("\nError:"+e). //Connection con=DriverManager. Program: import java.executeUpdate(str1).readLine(). try { /*Method1 using jdbc-odbc*/ //Class. System.sql. 5. 4.createStatement(). stat.").jdbc.} } catch(Exception e) { System. ResultSet result. Establish the connection between jdbc and odbc using DriverManager. String str1=new String().JdbcOdbcDriver"). } } } For DELETE: Algorithm: 1."tiger").odbc.out. class Del { public static void main(String a[]) throws IOException { DataInputStream in=new DataInputStream(System. Get the acc_no that is to be deleted. /*Method2 using jdbc-oci*/ DriverManager.getConnection("jdbc:odbc:MyProj".OracleDriver()).jdbc.io.in).println("Enter the Ac_no:"). 3. System. Display the results. Delete the row from the table.*.forName("sun.getConnection("jdbc:oracle: oci8:scott/tiger@db9"). str=in. 2. import java."scott". Connection con=DriverManager.out.println("\n1 row Deleted.

5. ResultSet result. } } } For UPDATE: Algorithm: 1.out. enter the acc_no and the new amount."scott".} catch(Exception e) { System. System. try { /*Method1 using jdbc-odbc*/ //Class. 4. 3. Insert the values into the table using SQL.io. Double d1.getConnection("jdbc:odbc:MyProj".d2. import java.str3.forName("sun. . Validate the connection between jdbc and odbc using DriverManager.*.println("Enter the Ac_no:").out. d1=Double. System."tiger"). //Connection con=DriverManager.println("\nError:"+e). str2="select * from bank where ac_no="+str4.jdbc.GetConnection ().sql.out. To Update.*.readLine(). Display the results. import java. 2. Program: import java.lang.*.readLine().odbc.println("Enter the Deposit_Amount:").parseDouble(str3). String st. class Upd { public static void main(String a[])throws IOException { DataInputStream in=new DataInputStream(System.JdbcOdbcDriver"). str4=in. str3=in.in). Update the table using executeUpdate command in the embedded SQL. String str2=new String(). String str1=new String(). String str4.

jdbc.parseDouble(result. System. } catch(Exception e) { System. result=stat. st=Double.out.----------------. str1="update bank set balance="+st+"where ac_no="+str4.getConnection("jdbc:oracle: oci8:scott/tiger@db9").println("\n1 row Updated.")./*Method2 using jdbc-oci*/ DriverManager. } } } Database for the table “bank”: SQL> desc bank Name Null? Type ----------------------------------. Connection con=DriverManager.getString(3)). Statement stat=con.next(). d1=d1+d2. d2=Double.out.---------------------------AC_NO NOT NULL NUMBER(11) NAME VARCHAR2(10) BALANCE NUMBER(5) . result.createStatement(). stat.registerDriver(new oracle.toString(d1).OracleDriver()).executeQuery(str2).executeUpdate(str1).println("\nError:"+e).

Output: For SELECT: For Update: .

For INSERT: For DELETE: .

Marks 20 20 20 20 20 100 Marks Obtained .Contents Design Development Queries & Execution Viva Voce Record Total Max.

addr1 varchar2(10). &zipcode). DM. Set the regno of "Student" table as primary key. TOC. name varchar2(10). zipcode number(10). POM. regno. DM number(3). POM number(3). addr2 varchar2(10). '&state'. address1. For creating the database “test”: SQL> create table test (regno number(10). zipcode. Set regno of “Test” table as primary key. SQL> insert into student values (&regno. 2. : 8 Aim: To design and implementing Entity-Relationship model using Oracle and Visual Basic For Creating Backend : Algorithm: 1. CN. 4. address2. .Result: Ex No. MP_MC. '&name'. '&addr1'. state. CN number(3). primary key (regno)). Create a database using SQL for "student" table with attributes name. Create another database using SQL for table "test" with attributes regno. Queries: For creating the database “student”: SQL> create table student (regno number(10). DOB. MP_MC number(3). '&addr'. dob date. &dob. state varchar2(10). DBMS. DBMS number(3). 3.

TOC number(3). the marks of the students whose register number matches with those in Student table alone are displayed. "Mark" and “close” add the corresponding codes for the button.&dob. Create a form with form name “frm_Mark” for displaying the Marks.'&addr'. On clicking the Test button. Create a form with form name “frm_Student” with 3 command button for "Student". 5. 4.&zipcode). SQL> insert into test values(&regno. Coding: Form name = frm_Student • Coding for Student command : Private Sub cmdPersonal_Click() frm_Personal.'&name'.'&addr1'. the personal details of all the student in the database are displayed.Show End Sub • Coding for Close command : Private Sub cmdClose_Click() Unload me End Sub Form name = frm_Personal • Coding for Close command : Private Sub cmdClose_Click() Unload me End Sub . 2.'&state'.Show End Sub • Coding for Test command : Private Sub cmdMark_Click() frm_Mark. For Creating Frontend: Algorithm: 1. primary key (regno)). Create a form with form name “frm_Personal” for displaying the personal details. 3. On clicking the Student button.

---------------------------REGNO NOT NULL NUMBER(10) NAME VARCHAR2(10) DOB DATE ADDR1 VARCHAR2(10) ADDR2 VARCHAR2(10) STATE VARCHAR2(10) ZIPCODE NUMBER(10) Database for the table “test”: SQL> desc test Name Null? Type ----------------------------------.----------------.----------------.Form name = frm_Mark • Coding for Close command : Private Sub cmdClose_Click() Unload me End Sub Database for the table “student’: SQL> desc student Name Null? Type ----------------------------------.---------------------------REGNO NOT NULL NUMBER(10) DBMS NUMBER(3) CN NUMBER(3) POM NUMBER(3) MP_MC NUMBER(3) DM NUMBER(3) TOC NUMBER(3) .

Output: .

.

. : 9 Aim: To design a payroll processing and implementing the process using Oracle and Visual Basic For Creating Backend: Algorithm: 1. age. Create a database using SQL for “payroll” table with attributes emp_id. experience. DOJ. basic salary. PF and TA. DOB. gender. Marks 20 20 20 20 20 100 Marks Obtained Result: Ex No. emp_name.Contents Design Development Queries & Execution Viva Voce Record Total Max. HRA. address.

AddNew End Sub • Coding for update command : Private Sub cmdUpdate_Click() . "update". "delete". doj date. "Back" will take us to "frm_Main". "delete" is used to remove details of particular employee.2). &age. "report" will display employee name. &hra. '&name'. Set primary key for emp_id Queries: For creating the database “payroll”: SQL> create table payroll( id number(5).2)). 2. dob date. &bpay. &exp. "report" and "exit" and enter corresponding coding. '&gender'.2). ta number(5. &doj. '&addr'.gross salary and net salary. exp number(4). pf number(5. 8. "allowance" will perform calculation for allowance of an employee. SQL> insert into payroll values(&id. &pf). hra number(5. "update" is used to make changes in existing details of an employee. 7. For Creating Frontend: Algorithm: 1. "print" and "exit". "allowance". gender varchar2(10). Coding: Form name = frm_Main • Coding for Add command : Private Sub cmdAdd_Click() Adodc1. &ta. 3. age number(3). Place form with form name "frm_Report" and place 3 command buttons for "back".Recordset. bpay number(10). addr varchar2(10). 6. Place a form with from name "frm_Main" and Place 6 command buttons for “add”.emp_id .2. "add" is used to add new empolyee details. 5. &dob. name varchar2(10). 4.

Text = Val(txt_Basic.Delete MsgBox "Record Deleted" End Sub • Coding for Allowance command : Private Sub cmdAllow_Click() txt_HRA.Text) +Val(txt_TA.Text frm_Report.Text / 100 * 4 End Sub • Coding for Report command : Private Sub cmdReport_Click() frm_Report.Text frm_Report.Text = txt_Basic.Update MsgBox "Record Updated" End Sub • Coding for Delete command : Private Sub cmdDelete_Click() Adodc1.txt_EmpName.Show End Sub .Text = txt_EmpName.Text) – Val(txt_PF.Show frm_Report.Text) + Val(txt_HRA.Recordset.Text) End Sub • Coding for Exit command : Private Sub cmdExit_Click() Unload me End Sub Form name = frm_Report • Coding for Back command : Private Sub cmdBack_Click() Frm_Main.Text frm_Report.Text = txt_Basic.Text / 100 * 8 txt_TA.Text = txt_Basic.Text = txt_Basic.Adodc1.txt_GrossSal.txt_EmpID.Text / 100 * 12 txt_PF.Text = txt_EmpID.Recordset. txt_NetSal.

---------------------------ID NUMBER(5) NAME VARCHAR2(10) DOB DATE EXP NUMBER(4) GENDER VARCHAR2(10) AGE NUMBER(3) ADDR VARCHAR2(10) DOJ DATE BPAY NUMBER(10) HRA NUMBER(5.printform End Sub • Coding for Exit command : Private Sub cmdExit_Click() Unload me End Sub Database for the table “payroll”: SQL> desc payroll Name Null? Type ----------------------------------.2) TA NUMBER(5.2) .----------------.• Coding for Print command : Private Sub cmdPrint_Click() Frm_Main.2) PF NUMBER(5.

Output: .

Contents Design Development Queries & Execution Viva Voce Record Total Max. Marks 20 20 20 20 20 100 Marks Obtained .

Create a database using SQL for "bank" table with attributes "ac_no". Set "ac_no" as primary key for that table. name varchar2(10). Queries: For creating the database “bank’: SQL> create table bank( ac_no number(11). primary key(ac_no)). &balance). SQL> insert into bank values(&ac_no. '&name'.Result: Ex No. balance number(5). "name" and "balance” 2. : 10 Aim: To design a banking system and implementing the process using Oracle and Visual Basic For Creating Backend : Algorithm: 1. For Creating Frontend: Algorithm: .

cmdProces.Caption = "Check" End Sub • Coding for Close command : . 5.Visible = False frm_process. "Balance Enquiry" and “Exit” and enter corresponding codings. 2. Coding: Form name = frm_Main • Coding for Deposit command : Private Sub cmdDeposit_Click() frm_process. "Deposit " will add money to the account if we give account number and amount to be added. If given account number is wrong. then the message "NOT FOUND" will be displayed. 4.Show frm_Main.Caption = "Balance Enquiry System" frm_process. "withdraw" will drop money from the account .Caption = "Deposit System" frm_process.Caption = “Deposit” End Sub • Coding for Withdraw command : Private Sub cmdWithdraw_Click() frm_process.Visible = False frm_process. Place a form with form name "frm_Main" and caption and 4 command buttons for "deposit".Show frm_Main. Place a form with form name "process" and place 2 buttons for “process” and “cancel" and enter corresponding coding.cmdProcss.Caption = “Withdraw” End Sub • Coding for Balance Enquiry command : Private Sub cmdBalance_Click() frm_process.1.Caption = "Withdraw System" frm_process. "withdraw".lblAmt. 3.cmdProcss.lblAmt. "Balance Enquiry" will display the current balance in given account number.Show frm_Main.

Recordset.Recordset.Caption = "Withdraw" Then Adodc1.Filter = str2 lblBalance.Caption val2 = Text2.Private Sub cmdClose_Click() Unload me End Sub • Coding for Form Active (when ever the form gets active) : Private Sub frm_Main_Activate() frm_Main.Recordset.Visible = False If lblBalance.Caption = "" Then . str1.Recordset.Caption = "Bank Processing System" End Sub Form name = frm_Process • Coding for Process command : Private Sub cmdProcess_Click() Dim str.Caption = "" Then MsgBox ("not found") Else val1 = lblBalance.Caption = "Check" Then Adodc1.Visible = True End If If cmdProcess.Caption = "Deposit" Then Adodc1.Save lblBalacne. str2 As String str = "ac_no=" str1 = txt_AcNo.Text val3 = val1 .Visible = False If lblBalance.Visible = True End If End If If cmdProcess.Filter = str2 lblBalance.Text str2 = str + str1 If cmdProcess.Caption = val3 Adodc1.val2 lblBalance.Filter = str2 lblBalance.Recordset.Update Adodc1.

Caption val2 = txtAmt.----------------.Caption = val3 Adodc1.---------------------------AC_NO NOT NULL NUMBER(11) NAME VARCHAR2(10) BALANCE NUMBER(5) .MsgBox ("not found") Else val1 = lblBalance.Update Adodc1.Visible = True End If End If End Sub • Coding for Cancel command : Private Sub cmdCancel_Click() Unload Me End Sub • Coding for Form Load (when ever form gets loaded) : Private Sub frm_Process_Load() lblBalance.Visible = False End Sub Design of the table “bank”: SQL> desc bank Name Null? Type ----------------------------------.Recordset.Save lblBalance.Text val3 = Val(val1) + Val(val2) lblBalance.Recordset.

Output: .

Marks 20 20 20 20 20 100 Marks Obtained .Contents Design Development Queries & Execution Viva Voce Record Total Max.

author. Set primary key for member_id. : 11 Aim: To design a Library information system and implementing the process using Oracle and Visual Basic For Creating Backend : Algorithm: 1. price number(4). level. Create another database using SQL for “member” table with member_id. publisher varchar2(10). . Queries: For creating the database “library”: SQL> create table lib (id number(6).Result: Ex No. ISBN varchar2(10). 2. edition varchar2(10)). publisher. Create a database using SQL for “lib” table with attributes book_name. price and edition. max_books and validity. ISBN. book_name varchar2(10). Book_level varchar2(10). id. author varchar2(10). 3.

4. 6. max_books number(2).Show End Sub • Coding for Member Details command : Private Sub cmdMember_Click() frmSearch. '&edition'). enter member_id in it. '&name'. Place a form with form name "frm_Main" and 3 commands buttons for "book details". maximum number of books and validity.Show frmSearch. 5. For Creating Frontend: Algorithm: 1. If we click "student details".SQL> insert into library values (&id. 3. id. "student details" and "close" and enter corresponding codings. &max_books. validity date. For creating the database “member”: SQL> create table member (id number(10). If give member_id is correct then a form(frm_Member) will display the student name.lblFind. Using "Update" menu. &validity). there appears a form (frm_Book) with menu consisting "search". '&ISBN'. we can delete the unwanted book details. there appears a form (frm_Search).Caption = "Member ID" End Sub • Coding for Close command : Private Sub cmdClose_Click() Unload me End Sub . '&level'. level. primary key(id)). publisher. if we give book_name. "update" and "delete". price and edition will be displayed. '&publisher'. '&price'. If we click "BookDetails". then author. ISBN. SQL> insert into member values(&id. Using "search" menu. Coding: Form name = frm_Main • Coding for Book Details command : Private Sub cmdBook_Click() frm_Book. '&author'. 2. we can make changes and save the record. Using "delete" menu.

Recordset.Form name = frm_Book • Coding for Delete menu : Private Sub mnu_opt_del_Click() If Adodc1.Update Unload Me End Sub Form name = frm_Search • Coding for Cancel Command : .Recordset.Delete Adodc1.Recordset.Show End Sub • Coding for Update menu : Private Sub mnu_opt_update_Click() Adodc1.Recordset.") End If End Sub • Coding for Exit menu : Private Sub mnu_file_exit_Click() Unload Me End Sub • Coding for Search menu : Private Sub mnu_opt_search_Click() frm_Search.EOF = False Then Adodc1.Update End Sub Form name = frm_Member • Coding for Ok Command : Private Sub cmdOk_Click() Adodc1.MoveNext Else MsgBox ("Error: Deleting record that does not exist.Recordset.

Caption = "Member ID" Then b = "Reg_no=" c = txtFind.Adodc1.Caption = "Book Name" Then b = "book_name=" c = txtFind.Private Sub cmdCancel_Click() Unload Me End Sub • Coding for Ok Command : Private Sub cmdOk_Click() Dim a.Recordset.Text a = b + "'" + c + "'" frm_Book.---------------------------ID NUMBER(6) BOOK_NAME VARCHAR2(10) AUTHOR VARCHAR2(10) ISBN VARCHAR2(10) .Adodc1.Text <> "" Then MsgBox ("Book Found") Else MsgBox ("Book Not Found") End If Frm_Book.Filter = a frm_Member.Text a = b + "'" + c + "'" frm_Member.Show Unload Me End If End Sub Database for the table “lib”: SQL> desc lib Name Null? Type ----------------------------------. b.Filter = a If frm_Book.Adodc1.Refresh Unload Me End If If lblFind. c As String If lblFind.txtFind.----------------.Recordset.

PUBLISHER BOOK_LEVEL PRICE EDITION Database for the table “member”: SQL> desc member VARCHAR2(10) VARCHAR2(10) NUMBER(4) VARCHAR2(10) Name Null? Type ----------------------------------.----------------.---------------------------ID NOT NULL NUMBER(10) MAX_BOOKS NUMBER(2) VALIDITY DATE Output: .

.

.

Marks 20 20 20 20 20 100 Marks Obtained Result: .Contents Design Development Queries & Execution Viva Voce Record Total Max.