0% found this document useful (0 votes)
2 views46 pages

VB & Oracle Programs

The document outlines various Visual Basic programs including a simple arithmetic calculator, Fibonacci series generator, and employee details management. Each program includes an aim, algorithm, form design, and coding examples, demonstrating functionalities like basic arithmetic operations, loops, decision-making, and database queries. The document concludes with successful execution results for each program.

Uploaded by

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

VB & Oracle Programs

The document outlines various Visual Basic programs including a simple arithmetic calculator, Fibonacci series generator, and employee details management. Each program includes an aim, algorithm, form design, and coding examples, demonstrating functionalities like basic arithmetic operations, loops, decision-making, and database queries. The document concludes with successful execution results for each program.

Uploaded by

kjayasri786
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

SIMPLE ARITHMETIC CALCULATOR

AIM:
To develop a simple arithmetic calculator using Visual Basic that performs basic
operations
such as addition, subtraction, multiplication, and division with a graphical user interface.

ALGORITHM:

STEP 1: Start the program.


STEP 2: Initialize variables to store the first number and the selected operator.
STEP 3: Get the first number when the user clicks the digit buttons.
STEP 4: Store the operator when the user clicks +, -, *, or /.
STEP 5: Get the second number from the user.
STEP 6: Perform the calculation when = is clicked and display the result.
STEP 7: Clear or exit the program if the user clicks the Clear or Exit button.

FORM DESIGN:
PROGRAM CODING:
Dim m As String
Dim s As Double
Private Sub Command1_Click(Index As Integer)
Select Case Command1(Index).Caption
Case "+"
s = [Link]
[Link] = ""
m = "+"
Case "-"
s = [Link]
[Link] = ""
m = "-"
Case "*"
s = [Link]
[Link] = ""
m = "*"
Case "/"
s = [Link]
[Link] = ""
m = "/"

Case "="
If m = "+" Then
[Link] = s + Val([Link])
ElseIf m = "-" Then
[Link] = s- Val([Link])
ElseIf m = "*" Then
[Link] = s * Val([Link])
ElseIf m = "/" Then
[Link] = s / Val([Link])
End If
Case Else
[Link] = [Link] + Command1(Index).Caption
End Select
End Sub
Private Sub Command2_Click()
[Link] = ""
s=0
End Sub
Private Sub Command3_Click()
End
End Sub

OUTPUT:
RESULT:
Thus the above program has been run successfully.

2. LOOPS AND DECISION MAKING STATEMENTS

a)FIBONACCI SERIES

AIM:
To write a VB Program for generate Fibonacci Series.

ALGORITHM:

STEP - 1: Start the process.


STEP - 2: Create a new Project.
STEP - 3: Declare the variables a,b,c,series as integer type.
STEP - 4: Draw the picture box for seeing the output.
STEP - 5: Through the Input box enter the number of series for printing Fibonacci
series.
STEP - 6: Save and execute the project.
STEP - 7: Stop the process

FORM DESIGN

PROGRAM CODING
Dim a, b, c, series As Integer
Private Sub Command1_Click()
[Link]
series = InputBox("Enter the number of series") a = 1
For x = 1 To series If x > 2 Then
c=a+b
a=b
b=c
[Link] c & Space(2); Else
[Link] a & Space(2); End If
Next x
End Sub
OUTPUT:
RESULT:
Thus the above program has been run successfully.

b)SUM OF N NUMBERS

AIM:
To write a VB Program to find the sum of N numbers.
ALGORITHM

STEP - 1: Start the process.


STEP - 2: Create a new Project.
STEP - 3: Declare the variables a, n and sum as integer type.
STEP - 4: Keep the command button for getting the limit and finding the sum.
STEP - 5: Give the input for printing the sum of n numbers, based on the for loop the
input will be
given in the text box until the condition is true.
STEP - 6: Save and execute the project.
STEP - 7: Stop the process.

FORM DESIGN

PROGRAM CODING

Dim a, n, sum As Integer


Private SubCommand1_Click()
n = InputBox("Enter the limit")
End Sub
Private Sub Command2_Click()
sum = 0
For k = 1 To n
sum = sum + k
Next k
MsgBox "the result is" & sum
End Sub

OUTPUT:

RESULT:
Thus the above program has been run successfully.
[Link] FOR CREATING MENU AND MDI FORMS

AIM:
To write a VB Program for creating MENU and MDI forms.

ALGORITHM:

STEP -1: Start -> Program -> Microsoft Visual Studio 6.0-> Visual Basic 6.0
STEP -2: Select File -> New -> [Link]
STEP -3: Design the form with required controls.
STEP -4: Create a menu using Menu Editor.
STEP -5: Type the coding.
STEP -6: Build and execute the application.
STEP -7: Stop the program.

FORM DESIGN

PROGRAM CODING:

Private Sub mnuCircle_Click()


[Link]
[Link] = 3
[Link] (1800, 1800), 1000, vbBlue
End Sub
Private Sub mnuLine_Click()
[Link]
[Link] = 3
[Link] (2000, 2000)-(3500, 3500), vbRed
End Sub
Private Sub mnuRectanlge_Click()
[Link]
[Link] = 3
[Link] (300, 300)-Step(4000, 2000), vbGreen, B
End Sub
Private Sub mnuSquare_Click()
[Link]
[Link] = 3

[Link] (1300, 1300)-Step(1300, 1300), vbPink, B


End Sub

OUTPUT:

Printing Line
Printing Square

Printing Circle

RESULT:

Thus the above program has been run successfully.


4. CONTROLS USING RICH TEXT BOX CONTROL

AIM

To write a VB Program for display files in a directory using DriveListBox,


DirListBox and FileListBox control and open, edit and save text file using Rich
text box control.

ALGORITHM

STEP -1: Start -> Program -> Microsoft Visual Studio 6.0-> Visual Basic 6.0
STEP -2: Select File -> New -> [Link]
STEP -3: Design the form with Drive ListBox, Dir ListBox and File ListBox
STEP -4: Insert Rich Text Box using Project -> Components ->
“Microsoft Rich Text Box 6.0” -> OK
STEP -5: Type the coding
STEP -6: Build and execute the application
STEP -7: Stop the program

FORM DESIGN
PROGRAM CODING

Private Sub Dir1_Change()


[Link] = [Link]
End Sub

Private Sub Drive1_Change()


[Link] = Left$([Link], 1) & ":\"
End Sub

Private Sub File1_Click()


[Link] = [Link] & "\" & [Link]
End Sub

OUTPUT

RESULT

Thus the above program has been run successfully.


[Link] DIALOG CONTROL

AIM

To write a VB Program for illustrate Common Dialog Control for to


Open,Edit and Save text file.

ALGORITHM

STEP -1: Start -> Program -> Microsoft Visual Studio 6.0-> Visual Basic 6.0
STEP -2: Select File -> New -> [Link]
STEP -3: Design the form with required controls
STEP -4: Insert Rich Text Box using Project -> Components ->
“Microsoft Rich Text Box 6.0” -> OK
STEP -5: Insert Common Dialog Control using Project -> Components ->
“Microsoft Common Dailog Control 6.0” -> OK
STEP -6: Type the coding
STEP -7: Build and execute the application
STEP -8: Stop the program

FORM DESIGN
PROGRAM CODING

Private Sub Command1_Click()


[Link]
[Link] = [Link]
End Sub

Private Sub Command2_Click()


[Link] = 1
[Link]
[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
End Sub

Private Sub Command4_Click()


[Link]
[Link] = [Link]
End Sub

Private Sub Command5_Click()


[Link]
[Link] [Link]
End Sub

OUTPUT
Open dialog box

Font dialog box


Color palette dialog box

Save dialog box

RESULT

Thus the above program has been run successfully.


[Link] USING TIMERS

AIM

To write a VB Program for timer using some animations.

ALGORITHM

STEP -1: Start -> Program -> Microsoft Visual Studio 6.0-> Visual Basic 6.0
STEP -2: Select File -> New -> [Link]
STEP -3: Design the form and insert image boxes and a timer control
STEP -4: Type the coding
STEP -5: Build and execute the application
STEP -6: Stop the program.

FORM DESIGN

PROGRAM CODING

Dim cnt As Integer


Dim sec As Integer

Private Sub Command1_Click()


[Link] = True
[Link] = 5
End Sub

Private Sub Form_Load()


cnt = 0
sec = 5
End Sub

Private Sub Timer1_Timer()


cnt = cnt + 1
sec = sec - 1
[Link] = sec
If cnt = 5 Then
[Link] = vbRed
[Link] = &H80FF80
[Link] = &HC0FFFF
sec = 5
ElseIf cnt = 15 Then
[Link] = &H8080FF
[Link] = vbGreen
[Link] = &HC0FFFF
sec = 5
ElseIf cnt = 10 Then
[Link] = &H8080FF
[Link] = &H80FF80
[Link] = vbYellow
sec = 5

ElseIf cnt = 20 Then


cnt = 0
sec =5
End If End
Sub

OUTPUT
RESULT

Thus, the above program has been run successfully.


7. NUMBERS CONVERSION FROM DECIMAL TO BINARY, OCTAL AND
HEXADECIMAL

AIM:

To write a Visual Basic program to convert a given decimal number into its binary, octal,
and hexadecimal equivalents.

ALGORITHM:

STEP -1: Start the program.

STEP -2 :Enter a decimal number in Text1.

STEP -3:Click BINARY button to convert decimal to binary using repeated division by 2.

STEP -4:Click OCTAL button to convert decimal to octal using repeated division by 8.

STEP -5:Click HEXA button to convert decimal to hexadecimal using repeated division
by 16 and map remainders 10–15 to A–F.

STEP -6:Display the result in Text2.

STEP -7:Click EXIT button to end the program.

STEP -8:Stop the program.


FORM DESIGN

CODING

Dim A As Integer
Dim B As Integer
Private Sub BINARY_Click()
[Link] = ""
A = Val([Link])
While A > 1
B = A Mod 2
[Link] = B & [Link]
A = Int(A / 2)
Wend
[Link] = A & [Link]
End Sub

Private Sub OCTAL_Click()


[Link] = ""
A = Val([Link])
While A > 7
B = A Mod 8
[Link] = B & [Link]
A = Int(A / 8)
Wend
[Link] = A & [Link]
End Sub

Private Sub HEXA_Click()


[Link] = ""
A = Val([Link])
While A >= 10
B = A Mod 16
Select Case B
Case 10
[Link] = "A" & [Link]
Case 11
[Link] = "B" & [Link]
Case 12
[Link] = "C" & [Link]
Case 13
[Link] = "D" & [Link]
Case 14
[Link] = "E" & [Link]
Case 15
[Link] = "F" & [Link]
Case Else
[Link] = B & [Link]

End Select
A = Int(A / 16)
Wend
If A = 0 Then
[Link] = [Link]
Else

[Link] = A & [Link]


End If
End Sub

Private Sub EXIT_Click()


End
End Sub
OUTPUT

RESULT

Thus, the above program has been run successfully.

8. EMPLOYEE DETAILS

AIM:

To create an EMPLOYEE table with Employee Number as the Primary Key and fields
— Name, Designation, Gender, Age, Date of Joining, and Salary — then insert at least
ten records and perform queries using Comparison, Logical, Set, Sorting, and Grouping
operators.

ALGORITHM

STEP -1:Start the program.

STEP -2:Create a table named EMPLOYEE with fields: EmpNo, Name, Designation,
Gender, Age, DOJ, and Salary.

STEP -3:Set EmpNo as the Primary Key.


STEP -4:Insert at least ten records into the EMPLOYEE table.

STEP -5:Use Comparison operator (e.g., WHERE Salary > 30000) to retrieve
employees based on a condition.

STEP -6:Use Logical operator (e.g., WHERE Gender='M' AND Salary > 25000) to
combine multiple conditions.

STEP -7:Use Set operator (e.g., UNION, INTERSECT, or MINUS) to combine results of
two queries.

STEP -8:Use Sorting operator (e.g., ORDER BY Salary DESC) to sort the records.

STEP -9:Use Grouping operator (e.g., GROUP BY Designation) to group data and
apply aggregate functions like SUM, AVG, or COUNT.

STEP -10:Display all query results.

STEP -11:Stop the program.

QUERIES:

SQL>CREATE TABLE employee ( empno NUMBER(5) CONSTRAINT empno_pk PRIMARY


KEY, empname VARCHAR2(15), gender CHAR(1), age NUMBER(2),designation
VARCHAR2(10), doj DATE, salary NUMBER(10,2));

Table created.

-- Insert 10 records
SQL> INSERT INTO employee VALUES(1517,'Ramesh','M',23,'Manager',TO_DATE('04-FEB-
2006','DD-MON-YYYY'),250000);

SQL>INSERT INTO employee VALUES(1539,'Afridi','M',20,'Assmanager',TO_DATE('02-MAR-


2008','DD-MON-YYYY'),200000);

SQL>INSERT INTO employee VALUES(1512,'PraveenKumar','M',21,'Teamlead',TO_DATE('02-


MAR-2007','DD-MON-YYYY'),225000);

SQL>INSERT INTO employee VALUES(1533,'Sasee','M',20,'Employee',TO_DATE('02-MAY-


2010','DD-MON-YYYY'),25000);

SQL>INSERT INTO employee VALUES(1538,'Sethupathi','M',19,'Employee',TO_DATE('03-


MAY-2010','DD-MON-YYYY'),25000);

SQL>INSERT INTO employee VALUES(1532,'Saravanan','M',19,'Employee',TO_DATE('03-


MAY-2012','DD-MON-YYYY'),20000);
SQL>INSERT INTO employee VALUES(1516,'Ramesh_B','M',20,'Analysis',TO_DATE('03-OCT-
2009','DD-MON-YYYY'),100000);

SQL>INSERT INTO employee VALUES(1551,'TamilPrasad','M',19,'Employee',TO_DATE('03-


AUG-2013','DD-MON-YYYY'),15000);

SQL>INSERT INTO employee VALUES(1518,'Ramya','F',19,'Employee',TO_DATE('03-AUG-


2015','DD-MON-YYYY'),15000);

SQL>INSERT INTO employee VALUES(1507,'Pragathi','F',19,'Coding',TO_DATE('03-APR-


2010','DD-MON-YYYY'),85000);

SQL>Select * from employee;

Comparison:

SQL>SELECT empname, salary FROM employee WHERE salary > 25000;

EMPNAME SALARY

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

Ramesh 250000

Afridi 200000

PraveenKumar 225000

Ramesh_B 100000

Pragathi 85000

Logical:

SQL>SELECT empname, salary FROM employee WHERE age < 20 AND gender='M';

EMPNAME SALARY

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

Sethupathi 25000

Saravanan 20000

TamilPrasad 15000

Set:

SQL>SELECT SYSDATE AS mydate FROM dual UNION ALL SELECT SYSDATE FROM dual;

MYDATE
-------------

19-JUL-19

19-JUL-19

Sorting:

SQL>SELECT empno, empname FROM employee ORDER BY empname DESC;

EMPNO EMPNAME

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

1551 TamilPrasad

1538 Sethupathi

1533 Sasee

1532 Saravanan

1518 Ramya

1516 Ramesh_B

1517 Ramesh

1512 PraveenKumar

1507 Pragathi

1539 Afridi

Grouping:

SQL>SELECT COUNT(designation), designation FROM employee GROUP BY designation;

SQL>SELECT SUM(salary), AVG(salary), MAX(salary), MIN(salary) FROM employee;

GROUP FUNCTION

SUM(SALARY) AVG(SALARY) MAX(SALARY) MIN(SALARY)

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

960000 96000 250000 15000

SQL> select max(age),min(age) from employee;

GROUP FUNCTION
MAX(AGE) MIN(AGE)

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

23 19

SQL>commit;

RESULT
Thus, the above program has been run successfully.

9. PL/SQL - INVENTORY DATABASE

AIM

To write a PL/SQL program to update the Rate field by 20% more than the current
rate in the Inventory table which contains the fields Prono, ProName, and Rate.
After updating, add a new field named Number_of_Item and insert values into that
field without using a PL/SQL block.

ALGORITHM
STEP -1:Start the program.
STEP -2:Create the table Inventory with the following fields:

○ Prono — Product Number

○ ProName — Product Name

○ Rate — Product Rate

STEP -3:Insert some sample records into the table.

STEP -4:Write a PL/SQL block to:

○ Update the Rate by adding 20% of the current rate (Rate := Rate +
(Rate * 0.2)).

○ Display a confirmation message after the update.

STEP -5:Execute the PL/SQL block to update the rates.

STEP -6:Without PL/SQL, use ALTER TABLE to add a new column Number_of_Item
to the table.
STEP -7:Use UPDATE statement (SQL command) to place values into the new field.

STEP -8:Display the updated table using a SELECT statement.

STEP -9:Stop.

QUERIES:

SQL> create table inventory(prono number(5), proname varchar2(20), rate

number(10,2));

Table created.

SQL> insert into inventory values(&prono,'&proname',&rate);

Enter value for prono: 15

Enter value for proname: Monitor

Enter value for rate: 27000

old 1: insert into inventory values(&prono,'&proname',&rate)

new 1: insert into inventory values(15,'Monitor',27000)

1 row created.

SQL> /

Enter value for prono: 7

Enter value for proname: Mouse

Enter value for rate: 500

old 1: insert into inventory values(&prono,'&proname',&rate)

new 1: insert into inventory values(7,'Mouse',500)

1 row created.
SQL> /

Enter value for prono: 25

Enter value for proname: Keyboard

Enter value for rate: 3000

old 1: insert into inventory values(&prono,'&proname',&rate)

new 1: insert into inventory values(25,'Keyboard',3000)

1 row created.

SQL> ttitle center "INVENTORY";

SQL> select * from inventory;

INVENTORY

PRONO PRONAME RATE

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

15 Monitor 27000

7 Mouse 500

25 Keyboard 3000

SQL> begin

2 update inventory set rate=rate+(rate*20/100);

3 end;

4/

PL/SQL procedure successfully completed.

SQL> ttitle center "INVENTORY";


SQL> select * from inventory;

INVENTORY

PRONO PRONAME RATE

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

15 Monitor 32400

7 Mouse 600

25 Keyboard 3600

SQL> alter table inventory add(no_of_items number(5));

Table altered.

SQL> select * from inventory;

INVENTORY

PRONO PRONAME RATE NO_OF_ITEMS

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

15 Monitor 32400

7 Mouse 600

25 Keyboard 3600

SQL> update inventory set no_of_items=10;

3 rows updated.

SQL> select * from inventory;

INVENTORY

PRONO PRONAME RATE NO_OF_ITEMS

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

15 Monitor 32400 10
7 Mouse 600 10

25 Keyboard 3600 10

SQL> commit;

RESULT

Thus, the above program has been run successfully.

10. TRIGGERS

AIM

To write a PL/SQL program using triggers to check that the product number (mno) and
transaction number (tno) are not NULL before inserting or updating records in the
tables imaster and itrans.

ALGORITHM (Simple Steps)

STEP -1:Create a table imaster with fields mno, mname, and rate.

STEP -2:Create a table itrans with fields tno, mno, istack, and qty.

STEP -3:Create a trigger named mno_validity on the imaster table.

○ It should run before insert or update.


○ If :[Link] is NULL, show an error message.

STEP -4:Create another trigger named tno_validity on the itrans table.

○ It should also run before insert or update.


○ If :[Link] is NULL, show an error message.

STEP -5:Try inserting a record with NULL value for mno or tno.

○ The trigger should stop the operation and display an error.


STEP -6:Display table data using SELECT statement.

STEP -7:End the program.

QUERIES

SQL> create table imaster(mno number(3), constraint mno_pk primary key(mno),

mname varchar2(15), rate number(7,2));

Table created.

SQL> insert into imaster values(&mno,'&mname',&rate);

Enter value for mno: 7

Enter value for mname: computer

Enter value for rate: 27000

old 1: insert into imaster values(&mno,'&mname',&rate)

new 1: insert into imaster values(7,'computer',27000)

1 row created.

SQL> create table itrans(tno number(3), mno number(3), constraint mno_fk foreign

key(mno) references imaster, istack number(5), qty number(5));

Table created.

SQL> insert into itrans values(&tno,&mno,&istack,&qty);

Enter value for tno: 5

Enter value for mno: 7

Enter value for istack: 25

Enter value for qty: 5


old 1: insert into itrans values(&tno,&mno,&istack,&qty)

new 1: insert into itrans values(5,7,25,5)

1 row created.

SQL> set serveroutput on

SQL> create or replace trigger mno_validity before insert or update of mno on imaster

for each

row

2 declare

3 cursor cm is select mno from imaster;

4 begin

5 if :[Link] is null then

6 raise_application_error(-20005,'Product number cannot be null');

7 end if;

8 end;

9/

Trigger created.

SQL> insert into imaster values(&mno,'&mname',&rate);

Enter value for mno: null

Enter value for mname: mouse

Enter value for rate: 250

old 1: insert into imaster values(&mno,'&mname',&rate)

new 1: insert into imaster values(null,'mouse',250)

insert into imaster values(null,'mouse',250)


*

ERROR at line 1:

ORA-20005: PRODUCT NUMBER CANNOT BE NULL

ORA-06512: at "[Link]", line 5

ORA-04088: error during execution of trigger '[Link]'

SQL> update imaster set mno=null where mname='computer';

update imaster set mno=null where mname='computer'

ERROR at line 1:

ORA-20005: PRODUCT NUMBER CANNOT BE NULL

ORA-06512: at "[Link]", line 5

ORA-04088: error during execution of trigger '[Link]'

SQL> select * from imaster ;

MNO MNAME RATE

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

7 computer 27000

SQL> create or replace trigger TNO_VALIDITY before insert or update of tno on

itrans for each row

2 declare

3 cursor t is select tno from itrans;


4 begin

5 if :[Link] is null then

6 raise_application_error(-20020,'PRODUCT NUMBER CANNOT BE NULL');

7 end if;

8 end;

9/

Trigger created.

SQL> insert into itrans values(&tno,&mno,&istack,&qty);

Enter value for tno: null

Enter value for mno: 11

Enter value for istack: 23

Enter value for qty: 5

old 1: insert into itrans values(&tno,&mno,&istack,&qty)

new 1: insert into itrans values(null,11,23,5)

insert into itrans values(null,11,23,5)

ERROR at line 1:

ORA-20020: PRODUCT NUMBER CANNOT BE NULL

ORA-06512: at "SYSTEM.TNO_VALIDITY", line 5

ORA-04088: error during execution of trigger 'SYSTEM.TNO_VALIDITY'

SQL> select * from itrans;

TNO MNO ISTACK QTY


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

5 7 25 5

RESULT

Thus, the above program has been run successfully.

11. PL/SQL PROCEDURES

AIM

To write a PL/SQL program using procedures to display a message (“HELLO


WORLD!”) and to find the minimum of two numbers using a user-defined procedure.

ALGORITHM

Part 1: Greetings Procedure

STEP -1:Start the program.

STEP -2:Create a procedure named greetings.

STEP -3:In the procedure body, use the built-in function DBMS_OUTPUT.PUT_LINE to
display the message “HELLO WORLD!”.

STEP -4:Execute the procedure using the EXECUTE command.

STEP -5:End the program.

Part 2: Find Minimum Procedure


STEP -1:Start the PL/SQL block.
STEP -2:Declare three numeric variables: a, b, and c.

STEP -3:Define a procedure findmin(x IN number, y IN number, z OUT


number) inside the block.

In the procedure body:

○ Compare x and y.

○ If x is less than y, assign x to z; otherwise, assign y to z.

STEP -4:Assign values to a and b.

STEP -5:Call the procedure findmin(a, b, c) to find the smaller number.

STEP -6:Display the result using DBMS_OUTPUT.PUT_LINE.

STEP -7:End the program.

QUERIES

SQL> set serveroutput on size 30000;

SQL> create or replace procedure greetings

2 As

3 begin

4 dbms_output.put_line('HELLO WORLD!');

5 end;

6/

Procedure created.

SQL> execute greetings;

HELLO WORLD!
PL/SQL procedure successfully completed.

SQL> declare

2 a number;

3 b number;

4 c number;

5 procedure findmin(x in number, y in number, z out number) is

6 begin

7 if x<y then

8 z:=x;

9 else

10 z:=y;

11 end if;

12 end;

13 begin

14 a:=23;

15 b:=45;

16 findmin(a,b,c);

17 dbms_output.put_line('minimum of(23,45) : ' || c);

18 end;

19 /

minimum of(23,45) : 23

PL/SQL procedure successfully completed.


RESULT

Thus, the above program has been run successfully.

12. STUDENT MARK LIST

AIM

To create, add, save, and delete student records using a Visual Basic application
connected to a database table (student1) through an ADODC (ActiveX Data Object
Data Control).

Algorithm

STEP -1:Start the program.

STEP -2:Create the table student1 in the database.

STEP -3:Design a VB form with text boxes, buttons, and ADODC control.

STEP -4:Click Add to create a new record.

STEP -5:Enter student details in text boxes.

STEP -6:Click Save to store the record.

STEP -7:Click Delete to remove a record.

STEP -8:Click Exit to close the application.

STEP -9:Stop the program.

FORM DESIGN
Queries:

SQL> create table student1(sid number(10),sname varchar2(20),class


varchar2(20),deptvarchar2(25), address varchar2(20),city varchar2(20),phno
number(10));

Table created.

SQL> insert into student1 values(1,'Kaviya','III-bsc','cs','Erode','Erode',9092280817);

1 row created.

SQL> select * from student1;

SID SNAME CLASS DEPT ADDRESS CITY PHNO

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

1 Kaviya III Bsc cs Erode Erode 9092280817


CODING:

Private Sub add_Click()

[Link]

[Link] = " "

[Link] = " "

[Link] = " "

[Link] = " "

[Link] = " "

[Link] = " "

[Link] = " "

[Link]

End Sub

Private Sub delete_Click()

[Link]

[Link] = " "

[Link] = " "

[Link] = " "

[Link] = " "

[Link] = " "

[Link] = " "

[Link] = " "

MsgBox ("record deleted")

'[Link]
End Sub

Private Sub exit_Click()

End

End Sub

Private Sub save_Click()

[Link](0) = [Link]

[Link](1) = [Link]

[Link](2) = [Link]

[Link](3) = [Link]

[Link](4) = [Link]

[Link](5) = [Link]

[Link](6) = [Link]

[Link]

MsgBox ("record saved")

End Sub

OUTPUT
RESULT

Thus, the above program has been run successfully.

You might also like