7/27/2019 Vb Vc++ Oracle practical programs
1/86
1
7/27/2019 Vb Vc++ Oracle practical programs
2/86
2
AIM:
To write a visual basic program to accept a number as input and convertthem into
a. Binary
b. Octal
c. Hexadecimal
ALGORITHM:
Step1: Start the process.
Step2: Click start-> all programs->microsoft visual studio 6.0-> visual basic 6.0.
Step3: Select stansard.exe and open a new project window with from.
Step4.Design the form 4 labels and 4 textboxes and 4 buttons.
Step5: Enter the entity inside the text boxes
Step6: Convert to values binary, octal and hexadecimal values.
Step7: Stop the process.
EX.NO: 1 NUMBER CONVERSION
DATE:20.06.13
7/27/2019 Vb Vc++ Oracle practical programs
3/86
3
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
4/86
4
SOURCE CODE:
Private Sub Command1_Click()
Text2 = ""
n = Val(Text1)
Do While (n 0)
a = n Mod 2
Text2 = Str(a) + Text2
n = Int(n / 2)
Loop
End Sub
Private Sub Command2_Click()
Text2 = ""
n = Val(Text1)
Do While (n 0)
a = n Mod 8
Text2 = Str(a) + Text2
n = Int(n / 8)
Loop
End Sub
Private Sub Command3_Click()
Text2 = ""
n = Val(Text1)
7/27/2019 Vb Vc++ Oracle practical programs
5/86
5
Do While (n 0)
a = n Mod 16
Select Case a
Case 10
Text2 = "a" + Text2
Case 11
Text2 = "b" + Text2
Case 12
Text2 = "c" + Text2
Case 13
Text2 = "d" + Text2
Case 14
Text2 = "e" + Text2
Case 15
Text2 = "f" + Text2
Case Else
Text2 = Str(a) + Text2
End Select
n = Int(n / 16)
Loop
End Sub
7/27/2019 Vb Vc++ Oracle practical programs
6/86
6
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
7/86
7
AIM:
To write a visual basic program to add the items to list box with user inputand move the select item to combo box one by one.
ALGORITHM:
Step1: Start the process.
Step2: Click Start-> All programs->Microsoft visual studio 6.0-> visual basic 6.0.
Step3: Select stansard.exe and open a new project window with from.
Step4: Design from with one label box, text box, List box, combo box and
Command buttons and set their properties.
Step5: Move the selected list item into the combo box using property add item
(list, text1).
Step6: Stop the process.
EX.NO: 2 ADD THE ITEMS
DATE:26.06.13
7/27/2019 Vb Vc++ Oracle practical programs
8/86
8
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
9/86
9
SOURCE CODE:
Private Sub Command1_Click()
Combo1.AddItem (Text1.Text)
Text1 = ""
End Sub
Private Sub Command2_Click()
List1.AddItem (Combo1.Text)
End Sub
Private Sub Command3_Click()
End
End Sub
7/27/2019 Vb Vc++ Oracle practical programs
10/86
10
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
11/86
11
AIM:
To write a visual basic program to develop a calculator with basic
operations.
ALGORITHM:
Step1: Start the process.
Step2: Click Start-> All programs->Microsoft visual studio 6.0-> visual basic 6.0.
Step3: Select stansard.exe and open a new project window with from.
Step4: Design the form with one textbox and seven command buttons, command 1
copy of commands is used to display numbers.
Step5: Perform the require calculations using arithmetic operations.
Step6: Stop the process.
EX.NO: 3
CALCULATORDATE:08.07.13
7/27/2019 Vb Vc++ Oracle practical programs
12/86
12
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
13/86
13
SOURCE CODE:
Dim n As Integer
Dim sign As String
Private Sub Command1_Click(Index As Integer)
Text1 = Text1 + Command1(Index).Caption
End Sub
Private Sub Command2_Click()
n = Val(Text1)
Text1 = ""
sign = "+"
End Sub
Private Sub Command3_Click()
n = Val(Text1)
Text1 = ""
sign = "-"
End Sub
Private Sub Command4_Click()
n = Val(Text1)
Text1 = ""
sign = "*"
7/27/2019 Vb Vc++ Oracle practical programs
14/86
14
End Sub
Private Sub Command5_Click()
n = Val(Text1)
Text1 = ""
sign = "/"
End Sub
Private Sub Command6_Click()
n = 0
Text1 = ""
End Sub
Private Sub Command7_Click()
Select Case sign
Case "+"
Text1 = n + Val(Text1)
Case "-"
Text1 = n - Val(Text1.Text)
Case "*"
Text1 = n * Val(Text1.Text)
Case "/"
Text1 = n / Val(Text1.Text)
End Select
End Sub
7/27/2019 Vb Vc++ Oracle practical programs
15/86
15
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
16/86
16
AIM:
To write a visual basic program to design form using common dialog boxcontrol to display font, save, new, open without using the action control property.
ALGORITHM:
Step1: Start the process.
Step2: Click Start-> All programs->Microsoft visual studio 6.0-> visual basic 6.0.
Step3: Select stansard.exe and open a new project window with from.
Step4: Click the project menu bar-> components and select these two control
added to tool bar.
Step5: Draw two controls to use common dialog control methods.
Step6: Stop the process.
EX.NO: 4
DIALOG BOX CREATIONDATE:18.07.13
7/27/2019 Vb Vc++ Oracle practical programs
17/86
17
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
18/86
18
SOURCE CODE:
Private Sub font_Click()
CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects
CommonDialog1.ShowFont
RichTextBox1.SelFontName = CommonDialog1.FontName
RichTextBox1.SelFontSize = CommonDialog1.FontSize
RichTextBox1.SelBold = CommonDialog1.FontBold
RichTextBox1.SelUnderline = CommonDialog1.FontUnderline
RichTextBox1.SelColor = CommonDialog1.Color
End Sub
Private Sub new_Click()
RichTextBox1.Text = ""
End Sub
Private Sub open_Click()
CommonDialog1.Filter = "textfile(*.txt)"
CommonDialog1.ShowOpen
RichTextBox1.LoadFile (CommonDialog1.FileName)
End Sub
Private Sub save_Click()
CommonDialog1.Filter = "textfile.text"
CommonDialog1.ShowSave
RichTextBox1.SaveFile (CommonDialog1.FileName)
End Sub
7/27/2019 Vb Vc++ Oracle practical programs
19/86
19
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
20/86
20
AIM:
To write a visual basic program to prepare a questionnaires.
ALGORITHM:
Step1: Start the process.
Step2: Click Start-> All programs->Microsoft visual studio 6.0-> visual basic 6.0.
Step3: Select stansard.exe and open a new project window with from.
Step4: Design the form using required controls.
Step5: Click your answer and get the source.
Step6: Stop the process.
EX.NO: 5QUESTIONNAIRES
DATE:24.07.13
7/27/2019 Vb Vc++ Oracle practical programs
21/86
21
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
22/86
22
SOURCE CODE:
Private Sub Command1_Click()
Dim q1, q2, q3, q4, q5, marks As Integer
q1 = 0
q2 = 0
q3 = 0
q4 = 0
q5 = 0
If Option2 = True Then
q1 = 10
End If
If Option3 = True Then
q2 = 10
End If
If Option5 = True Then
q3 = 10
End If
If Option8 = True Then
q4 = 10
End If
If Option9 = True Then
q5 = 10
End If
marks = q1 + q2 + q3 + q4 + q5
Select Case marks
7/27/2019 Vb Vc++ Oracle practical programs
23/86
23
Case 10
Label7.Caption = marks
Label8.Caption = "not selected"
Case 20
Label7 = marks
Label8 = "not selected"
Case 30
Label7 = marks
Label8 = "waiting.."
Case 40
Label7 = marks
Label8 = "selected"
Case 50
Label7 = marks
Label8 = "selected"
End Select
End Sub
7/27/2019 Vb Vc++ Oracle practical programs
24/86
24
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
25/86
25
AIM:
To write a visual basic program to develop a menu driven adds a menudriven window in the form horizontal style using menu.
ALGORITHM:
Step1: Start the process.
Step2: Click Start-> All programs->Microsoft visual studio 6.0-> visual basic 6.0.
Step3: Select standard.exe and open a new project window with from.
Step4: Design the form using menu editor menu.
Step5: Include add from change the cascade of form and apply a color to the form
by using submenu.
Step6: Stop the process.
EX.NO: 6MENU CREATION
DATE:02.08.13
7/27/2019 Vb Vc++ Oracle practical programs
26/86
26
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
27/86
27
SOURCE CODE:
Private Sub af_Click()
Dim newform As New Form1
newform.Show
End Sub
Private Sub clr_Click()
CommonDialog1.ShowColor
Me.BackColor = CommonDialog1.Color
End Sub
Private Sub cs_Click()
Me.Arrange vbCascade
End Sub
Private Sub ex_Click()
End
End Sub
Private Sub hor_Click()
MDIForm1.Arrange vbHorizontal
End Sub
7/27/2019 Vb Vc++ Oracle practical programs
28/86
28
OUTPUT:
1. Cascade view:
7/27/2019 Vb Vc++ Oracle practical programs
29/86
29
2. Horizontal view:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
30/86
30
7/27/2019 Vb Vc++ Oracle practical programs
31/86
31
AIM:
To create VC++ program to display toolbar and status bar status.
PROCEDURE:
Step1: Start-> all programs ->visual studio 6.0->Microsoft visual c++
Step2: Select file-> new and choose option MFC application wizard (exe) and give
project name.
Step3: Click next option and select project type as single document interface andfinally press finish button.
Step4: New an empty project is created new we needed to design our toolbar.
Step5: Select resource view from left side of window from that choose toolbar
option and select string ID_DRAW_RECTANGLE, ID_DRAW_ELLIPS,
ID_DRAW_TRIANGLE.
Step6: Selecting class wizard (ctrl+w) add message map for rectangle, ellipse and
triangle.
Step7: Write a source code for a program.
Step8: Compile and execute program.
EX.NO: 1DISPLAY TOOLBAR & STATUS BAR
DATE:09.08.13
7/27/2019 Vb Vc++ Oracle practical programs
32/86
32
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
33/86
33
SOURCE CODE:
void CPrg1View::OnDrawRectangle()
{
CClientDC* pDC;
pDC=new CClientDC(this);
pDC->Rectangle(100,100,170,150);
}
void CPrg1View::OnDrawEllipse()
{
CClientDC* pDC;
pDC=new CClientDC(this);
pDC->Ellipse(10,10,200,100);
}
void CPrg1View::OnDrawTriangle()
{
CClientDC* pDC;
pDC=new CClientDC(this);
pDC->MoveTo(200,200);
pDC->LineTo(300,300);
pDC->LineTo(150,300);
pDC->LineTo(200,200);
pDC->SetBkColor(RGB(0,0,255));
pDC->TextOut(200,250,"vengat Vc++");
}
7/27/2019 Vb Vc++ Oracle practical programs
34/86
34
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
35/86
35
AIM:
To create VC++ program adding and deleting a string in list box.
PROCEDURE:
Step1: Start-> all programs ->visual studio 6.0->Microsoft visual c++
Step2: Select file-> new and choose option MFC application wizard (exe) and give
project name as list box.
Step3: Click next option select dialog based application as project
Step4: Finally press finish button new an empty dialog application is created.
Step5: Write a source code for a program.
Step6: Compile and executed the program.
EX.NO: 2ADD & DELETE STRING IN LISTBOX
DATE:19.08.13
7/27/2019 Vb Vc++ Oracle practical programs
36/86
36
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
37/86
37
SOURCE CODE:
void CPrg2Dlg::OnButton1()
{
UpdateData(TRUE);
CString a;
m_text.GetWindowText(a);
m_list.AddString(a);
MessageBox("ADDED");
m_text.SetWindowText(" ");
UpdateData(false);
}
void CPrg2Dlg::OnButton2()
{
m_list.DeleteString (m_list.GetCurSel ());
MessageBox("DELETED");
}
7/27/2019 Vb Vc++ Oracle practical programs
38/86
38
OUTPUT:
Result:
Thus the above program has been executed successfully and verified.
7/27/2019 Vb Vc++ Oracle practical programs
39/86
39
AIM:
To develop VC++ program for menu editor.
PROCEDURE:
Step1: Start-> all programs ->visual studio 6.0->Microsoft visual c++.
Step2: Select file-> new and choose option MFC application wizard (exe) and give
project name as menu bar.
Step3: Click next option and select project type as simple document interface and
finally press finish button.
Step4: Now an empty project is created menu we needed to design our menu.
Step5: Select resource view from left side of window from that chooses menu
option and design.
Step6: Write a source code for a program.
Step7: Compile and execute the program.
EX.NO: 3MENU EDITOR
DATE:27.08.13
7/27/2019 Vb Vc++ Oracle practical programs
40/86
40
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
41/86
41
SOURCE CODE:
void CMainFrame::OnDrawRectangle()
{
CClientDC* pDC;
pDC=new CClientDC(this);
pDC->Rectangle(100,100,180,140);
}
void CMainFrame::OnDrawEllipse()
{
CClientDC* pDC;
pDC=new CClientDC(this);
pDC->Ellipse(30,40,120,70);
}
void CMainFrame::OnDrawTriangle()
{
CClientDC* pDC;
pDC=new CClientDC(this);
pDC->MoveTo(200,200);
pDC->LineTo(300,300);
pDC->LineTo(150,300);
pDC->LineTo(200,200);
}
7/27/2019 Vb Vc++ Oracle practical programs
42/86
42
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
43/86
43
AIM:
To create VC++ application program to perform free hand drawing.
PROCEDURE:
Step1: Start-> all programs ->visual studio 6.0->Microsoft visual c++.
Step2: Select file-> new and choose option MFC application wizard (exe) and give
project name as HAND drawing.
Step3: Click next option select dialog based application as project
Step4: Finally press finish button new an empty dialog application is created.
Step5: Write a source code for a program.
Step6: Compile and executed the program
EX.NO: 4FREE HAND DRAWING
DATE:02.09.13
7/27/2019 Vb Vc++ Oracle practical programs
44/86
44
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
45/86
45
SOURCE CODE:
int flag = 0, x1, x2, y1, y2;
void CPrg3Dlg::OnLButtonDown(UINT nFlags, CPoint point)
{
if (flag == 0)
{
x1 = point.x;
y1 = point.y;
flag = 1;
}
CDialog::OnLButtonDown(nFlags, point);
}
void CPrg3Dlg::OnLButtonUp(UINT nFlags, CPoint point)
{
flag = 0;
CDialog::OnLButtonUp(nFlags, point);
}
void CPrg3Dlg::OnMouseMove(UINT nFlags, CPoint point)
{
if ( flag == 1)
{
x2 = point.x;
y2 = point.y;
CClientDC dc(this);
7/27/2019 Vb Vc++ Oracle practical programs
46/86
46
dc.MoveTo (x1, y1);
dc.LineTo (x2, y2);
x1 = x2;
y1 = y2;
}
CDialog::OnMouseMove(nFlags, point);
}
void CPrg3Dlg::OnCancel()
{
CDialog::OnCancel ();
CDialog::OnCancel();
}
7/27/2019 Vb Vc++ Oracle practical programs
47/86
47
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
48/86
48
AIM:
To create VC++ program to perform SERTALRATION-SDI.
PROCEDURE:
Step1: Start-> all programs ->visual studio 6.0->Microsoft visual c++.
Step2: Select file-> new and choose option MFC application wizard (exe) and give
project name as menu bar.
Step3: Click next option and select project type as simple document interface and
finally press finish button.
Step4: Selecting ctrl+w have included VM_CHAR function for reading character
from user.
Step5: Write a source code for a program.
Step6: Compile and execute the program.
EX.NO: 5SERIALIZATION-SDI
DATE:18.09.13
7/27/2019 Vb Vc++ Oracle practical programs
49/86
49
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
50/86
50
SOURCE CODE:
Sdidoc.h:
class CSdiDoc : public CDocument
{protected: // create from serialization only
CSdiDoc();
DECLARE_DYNCREATE(CSdiDoc)
// Attributes
public:
CString text;
sdiDoc.cpp
CSdiDoc::CSdiDoc()
{
text=" ";
}
void CSdiView::OnDraw(CDC* pDC)
{
CSdiDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->TextOut(50,50,pDoc->text);
}
void CSdiView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CSdiDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->text+=nChar;
CView::OnChar(nChar, nRepCnt, nFlags);
}
7/27/2019 Vb Vc++ Oracle practical programs
51/86
51
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
52/86
52
AIM:
To create VC++ program to perform SERTALRATION-MDI.
PROCEDURE:
Step1: Start-> all programs ->visual studio 6.0->Microsoft visual c++.
Step2: Select file-> new and choose option MFC application wizard (exe) and give
project name.
Step3: Click next option and select project type as multiple document interfaces
and finally press finish button.
Step4: Selecting ctrl+w have included VM_CHAR function for reading character
from user.
Step5: Write a source code for a program.
Step6: Compile and execute the program.
EX.NO: 6SERIALIZATION-MDI
DATE:30.09.13
7/27/2019 Vb Vc++ Oracle practical programs
53/86
53
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
54/86
54
SOURCE CODE:
mdidoc.h:
public:
int m_posx;
int m_posy;
mddiDoc.cpp:
void CMddiDoc::Serialize(CArchive& ar){
if (ar.IsStoring()){
ar m_posx >> m_posy;
}}
mddiView.cpp:
void CMddiView::OnDraw(CDC* pDC){
CMddiDoc* pDoc = GetDocument();ASSERT_VALID(pDoc);
RECT br;br.left = m_posx - 50;
br.right = m_posx + 50;
br.bottom = m_posy - 50;
br.top = m_posy + 50;
pDC->Ellipse(&br);}
void CMddiView::OnInitialUpdate(){
CView::OnInitialUpdate();
CMddiDoc* pDoc;pDoc = GetDocument();
m_posx = pDoc->m_posx ;
m_posy = pDoc->m_posy;}void CMddiView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CMddiDoc* pDoc;
7/27/2019 Vb Vc++ Oracle practical programs
55/86
55
pDoc = GetDocument();
m_posx = pDoc->m_posx ;
m_posy = pDoc->m_posy ;
InvalidateRect(NULL);}
void CMddiView::OnLButtonDown(UINT nFlags, CPoint point){
m_posx = point.x;
m_posy = point.y;
CMddiDoc* pDoc;
pDoc = GetDocument();
pDoc->m_posx = m_posx;
pDoc->m_posy = m_posy;
InvalidateRect(NULL);
pDoc->UpdateAllViews (this);
pDoc->SetModifiedFlag (TRUE);
CView::OnLButtonDown(nFlags, point);
}
7/27/2019 Vb Vc++ Oracle practical programs
56/86
56
OUTPUT:
Result:
Thus the above program has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
57/86
57
7/27/2019 Vb Vc++ Oracle practical programs
58/86
58
AIM:
To create six tables and make constraint for the ticket_ no in table5 and add
new column fare to the table3 with data type as long.
ALGORITHM:
STEP 1: Start the process
STEP 2: Create six tables and display the structure.
STEP 3: Constraint is added into ticket_no from the table5 and check ticket_no
between 1 & 500.
STEP 4: New column is added to the table3, and the description is displayed.
STEP 5: Stop the Process.
EX.NO: 1DATA DEFINITION BASICS
DATE:27.06.13
7/27/2019 Vb Vc++ Oracle practical programs
59/86
59
SQL> create table christo1(cat_code number(3) primary key);
Table created.
SQL> desc christo1;
Name Null? Type
----------------------------------------- -------- ----------------------------
CAT_CODE NOT NULL NUMBER(3)
SQL> create table christo2(place_id number(3) primary key, bus_station varchar2(10));
Table created.
SQL> desc christo2;
Name Null? Type
----------------------------------------- -------- ----------------------------
PLACE_ID NOT NULL NUMBER(3)
BUS_STATION VARCHAR2(10)
SQL> create table christo3(rout_id number(3) primary key, cat_code number(3),orgin
varchar2(10), destination varchar2(10),distance_kms number(4));
Table created.
SQL> desc christo3;
Name Null? Type
----------------------------------------- -------- ----------------------------
ROUT_ID NOT NULL NUMBER(3)
CAT_CODE NUMBER(3)
ORGIN VARCHAR2(10)
DESTINATION VARCHAR2(10)
DISTANCE_KMS NUMBER(4)
7/27/2019 Vb Vc++ Oracle practical programs
60/86
60
SQL> create table christo4(route_id number(3), place_id number(3), day varchar(10));
Table created.
SQL> desc christo4;
Name Null? Type
----------------------------------------- -------- ----------------------------
ROUTE_ID NUMBER(3)
PLACE_ID NUMBER(3)
DAY VARCHAR2(10)
SQL> create table christo5(ticket_no number(3) primary key, no_of_ticket number(4));
Table created.
SQL> desc christo5;
Name Null? Type
----------------------------------------- -------- ----------------------------
TICKET_NO NOT NULL NUMBER(3)
NO_OF_TICKET NUMBER(4)
SQL> create table christo6(ticket_no number(3),passenger_name varchar2(10),gender
varchar2(6),age number(3),seat_no number(3),amount number(5));
Table created.
SQL> desc christo6;
Name Null? Type
----------------------------------------- -------- ---------------
TICKET_NO NUMBER(3)
PASSENGER_NAME VARCHAR2(10)
GENDER VARCHAR2(6)
AGE NUMBER(3)
7/27/2019 Vb Vc++ Oracle practical programs
61/86
61
SEAT_NO NUMBER(3)
AMOUNT NUMBER(5)
SQL> alter table christo5 add constraint ck_ticketno check(ticket_no between 1 and 500);
Table altered.
SQL> alter table christo3 add(fare long);
Table altered.
SQL> desc christo3;
Name Null? Type
----------------------------------------- -------- ----------------------------
ROUT_ID NOT NULL NUMBER(3)
CAT_CODE NUMBER(3)
ORGIN VARCHAR2(10)
DESTINATION VARCHAR2(10)
DISTANCE_KMS NUMBER(4)
FARE LONG
Result:
Thus the above queries has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
62/86
62
AIM:
Insert values for six tables and display the table with original and destinationcatcode from rh5 table and update fare as 500 to distance between Ooty and
Chennai.
ALGORITHM:
STEP 1: Start the process.
STEP 2: Values are inserted into six table displayed the table with the route
displayed the table with the route origin form Madras and destination By
select query.
STEP 3: Catcode column was displayed from the Table with descending order.
STEP 4: The distance was update into 500 for origin Madras to destination
Cochin from the table and displayed.
STEP 5: Stop the Process.
EX.NO: 2DATA MANIPULATION BASICS
DATE:03.07.13
7/27/2019 Vb Vc++ Oracle practical programs
63/86
63
SQL> insert into christo1 values(100);
1 row created.
SQL> insert into christo1 values(200);
1 row created.
SQL> insert into christo1 values(300);
1 row created.
SQL> insert into christo1 values(400);
1 row created.
SQL> insert into christo1 values(500);
1 row created.
SQL> select * from christo1;
CAT_CODE
----------
100
200
300
400
500
SQL> insert into christo2 values(11,'coimbatore');
1 row created.
SQL> insert into christo2 values(12,'tirupur');
1 row created.
SQL> insert into christo2 values(13,'chennai');
1 row created.
7/27/2019 Vb Vc++ Oracle practical programs
64/86
64
SQL> insert into christo2 values(14,'pollachi');
1 row created.
SQL> insert into christo2 values(15,'ooty');
1 row created.
SQL> select * from christo2;
PLACE_ID BUS_STATIO
---------- ----------
11 coimbatore
12 tirupur
13 chennai
14 pollachi
15 ooty
SQL> insert into christo3 values(101,100,'madras','cochin',599,1000);
1 row created.
SQL> insert into christo3 values(102,200,'cbe','tirupur',100,300);
1 row created.
SQL> insert into christo3 values(103,300, 'ooty','bangalore',500,350);
1 row created.
SQL> insert into christo3 values(104,400, 'madras','cbe',600,320);
1 row created.
SQL> insert into christo3 values(105,500, 'tirupur','bangalore',700,500);
1 row created.
SQL> select * from christo3;
7/27/2019 Vb Vc++ Oracle practical programs
65/86
65
ROUT_ID CAT_CODE ORGIN DESTINATIO DISTANCE_KMS
-------------- ---------- ---------- ---------- ------------
FARE
------------------------------------------------------------
101 100 madras cochin 599
1000
102 200 cbe tirupur 100
300
103 300 ooty bangalore 500
350
104 400 madras cbe 600
320
105 500 tirupur bangalore 700
500
SQL> insert into christo4 values(101,11,'monday');
1 row created.
SQL> insert into christo4 values(102,22,'tuesday');
1 row created.
SQL> insert into christo4 values(103,33,'wednesday');
1 row created.
SQL> insert into christo4 values(104,44,'thursday');
1 row created.
SQL> insert into christo4 values(105,55,'friday');
1 row created.
7/27/2019 Vb Vc++ Oracle practical programs
66/86
66
SQL> select * from christo4;
ROUTE_ID PLACE_ID DAY
---------- ---------- ----------
101 11 monday
102 22 tuesday
103 33 wednesday
104 44 thursday
105 55 friday
SQL> insert into christo5 values(27,6);
1 row created.
SQL> insert into christo5 values(200,67);
1 row created.
SQL> insert into christo5 values(487,90);
1 row created.
SQL> insert into christo5 values(499,6);
1 row created.
SQL> insert into christo5 values(456,89);
1 row created.
SQL> select * from christo5;
TICKET_NO NO_OF_TICKET
---------- ------------
27 6
200 67
487 90
7/27/2019 Vb Vc++ Oracle practical programs
67/86
67
499 6
456 890
SQL> insert into christo6 values(111,'christo','male',20,278,400);
1 row created.
SQL> insert into christo6 values(200,'deepa','female',18,425,786);
1 row created.
SQL> insert into christo6 values(249,'angel','female',20,278,400);
1 row created.
SQL> insert into christo6 values(186,'ganesh','male',20,480,815);
1 row created.
SQL> select * from christo6;
TICKETNO PASSENGER_ GENDER AGE SEAT_NO AMOUNT
---------- ---------- ------ ---------- ---------- ----------
111 christo male 20 278 400
200 deepa female 18 425 786
249 angel female 20 278 400
186 ganesh male 20 480 815
SQL> select * from christo3 where orgin = 'madras' and destination = 'cochin';
ROUT_ID CAT_CODE ORGIN DESTINATIO DISTANCE_KMS
---------- ---------- ---------- ---------- ------------
FARE
--------------------------------------------------------------------------------
101 100 madras cochin 599
1000
7/27/2019 Vb Vc++ Oracle practical programs
68/86
68
SQL> select distinct cat_code from christo3 order by cat_code desc;
CAT_CODE
----------
400
200
100
SQL> update christo3 set distance_kms=500 where orgin = 'madras' and destination='cbe';
1 row updated.
SQL> select * from christo3;
ROUT_ID CAT_CODE ORGIN DESTINATIO DISTANCE_KMS
---------- ---------- ---------- ---------- ------------
FARE
-----------------------------------------------------------------
101 100 madras cochin 599
1000
102 200 cbe tirupur 100
300
103 300 ooty bangalore 500
350
7/27/2019 Vb Vc++ Oracle practical programs
69/86
69
ROUT_ID CAT_CODE ORGIN DESTINATIO DISTANCE_KMS
---------- ---------- ---------- ---------- ------------
FARE
-----------------------------------------------------------------
104 400 madras cbe 500
320
105 500 tirupur bangalore 700
500
Result:
Thus the above queries has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
70/86
70
AIM:
Display the row from table6 with matching any row with table thus create a
view with ticket no, origin, destination route id from table.
ALGORITHM:
Step1: Start the process.
Step2: All rows are displayed with sub query from the table.
Step3: View the row from with place id=100;
Step4: All row displayed from views.
Step5: Stop the process.
EX.NO: 3 QUERIES
DATE:22.07.13
7/27/2019 Vb Vc++ Oracle practical programs
71/86
71
SQL> select * from christo6 where ticket_no>any (select ticket_no from christo5);
TICKET_NO PASSENGER_ GENDER AGE SEAT_NO AMOUNT
---------- ---------- ------ ---------- ---------- ----------
111 christo male 20 278 400
200 deepa female 18 425 786
249 angel female 20 278 400
186 ganesh male 20 480 815
SQL> select * from christo3 where rout_id >all(select route_id from christo4 where
place_id=100);
ROUT_ID CAT_CODE ORGIN DESTINATIO DISTANCE_KMS
---------- ---------- ---------- ---------- ------------
FARE
-------------------------------------------------------------
101 100 madras cochin 599
1000
102 200 cbe tirupur 100
300
103 300 ooty bangalore 500
350
ROUT_ID CAT_CODE ORGIN DESTINATIO DISTANCE_KMS
---------- ---------- ---------- ---------- ------------
FARE
-------------------------------------------------------------
7/27/2019 Vb Vc++ Oracle practical programs
72/86
72
104 400 madras cbe 500
320
105 500 tirupur bangalore 700
500
SQL> create view ksg as select ticket_no, orgin, destination, rout_id from christo5, christo3;
View created.
SQL> select * from ksg;
TICKET_NO ORGIN DESTINATIO ROUT_ID
---------- ---------- ---------- ----------
27 madras cochin 101
200 madras cochin 101
487 madras cochin 101
499 madras cochin 101
456 madras cochin 101
27 cbe tirupur 102
200 cbe tirupur 102
487 cbe tirupur 102
499 cbe tirupur 102
456 cbe tirupur 102
27 ooty bangalore 103
TICKET_NO ORGIN DESTINATIO ROUT_ID
---------- ---------- ---------- ----------
200 ooty bangalore 103
487 ooty bangalore 103
7/27/2019 Vb Vc++ Oracle practical programs
73/86
73
499 ooty bangalore 103
456 ooty bangalore 103
27 madras cbe 104
200 madras cbe 104
487 madras cbe 104
499 madras cbe 104
456 madras cbe 104
27 tirupur bangalore 105
200 tirupur bangalore 105
TICKET_NO ORGIN DESTINATIO ROUT_ID
---------- ---------- ---------- ----------
487 tirupur bangalore 105
499 tirupur bangalore 105
456 tirupur bangalore 105
25 rows selected.
Result:
Thus the above queries has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
74/86
74
AIM:
To generate a report from the table for the particular ticket no.
ALGORITHM:
Step1: Start the process.
Step2: All column names all justify into the center position.
Step3: Format are generate for all columns.
Step4: Compute amount for the ticket number.
Step5: Stop the process.
EX.NO: 4 REPORT GENERATION
DATE:30.07.13
7/27/2019 Vb Vc++ Oracle practical programs
75/86
75
SQL> ttitle center 'III BSC CS' skip 2
SQL> column ticket_no heading ticket_no justify center
SQL> column passenger_name heading passenger_name justify center
SQL> column gender heading gender justify center
SQL> column age heading age justify center
SQL> column seatno heading seatno justify center
SQL> column amount heading amount justify center
SQL> column ticket_no format 9999
SQL> column passenger_name format a13
SQL> column gender format a12
SQL> column age format 99
SQL> column seatno format 9999
SQL> column amount format 9999
SQL> compute sum of amount on ticket_no
SQL> break on ticket_no skip2
SQL> select ticket_no, passenger_name, gender, age, seat_no, amount from christo6 order by
ticket_no;
III BSC CS
ticket_no passenger_nam gender age SEAT_NO amount
--------- ------------------ ------------ --- ---------- ------
111 christo male 20 278 400
********* ------
sum 400
7/27/2019 Vb Vc++ Oracle practical programs
76/86
76
186 ganesh male 20 480 815
********* ------
sum 815
III BSC CS
ticket_no passenger_nam gender age SEAT_NO amount
------------ --------------- ------------ --- ---------- ----------
200 deepa female 18 425 786
********* ------
sum 786
249 angel female 20 278 400
********* ------
sum 400
Result:
Thus the above queries has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
77/86
77
AIM:
To update erode for bus station 200 for distance in table using PL/SQL and
create to insert trigger to table and display no transaction on weekends and not
allowing for deleting.
ALGORITHM:
Step1: Start the process.
Step2: Cursor was creating form table and bus station was updated as erode 50 or 1
and display.
Step3: Where place id=fare was updated as200 for the table where distance
was
7/27/2019 Vb Vc++ Oracle practical programs
78/86
78
SQL> select * from christo2;
PLACE_ID BUS_STATION
---------- ----------
11 coimbatore
12 tirupur
13 chennai
14 pollachi
15 ooty
SQL> desc christo2;
Name Null? Type
----------------------------------------- -------- ----------------------------
PLACE_ID NOT NULL NUMBER(3)
BUS_STATION VARCHAR2(10)
SQL> declare
2 begin
3 update christo2 set bus_station='COIMBATORE' where place_id=11 or place_id=15;
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> select * from christo2;
PLACE_ID BUS_STATIO
---------- ----------
11 COIMBATORE
7/27/2019 Vb Vc++ Oracle practical programs
79/86
79
12 tirupur
13 chennai
14 pollachi
15 COIMBATORE
SQL> declare
2 begin
3 update christo3
4 set fare=200 where rout_id=&user_value and distance_kms
7/27/2019 Vb Vc++ Oracle practical programs
80/86
80
ROUT_ID CAT_CODE ORGIN DESTINATIO DISTANCE_KMS
---------- ---------- ---------- ---------- ------------
FARE
------------------------------------------------------------
104 400 madras cbe 600
320
105 500 tirupur bangalore 700
500
SQL> create or replace trigger mbmb_tri
2 before insert on christo4
3 for each row
4 begin
5 if:new.day='saturday' or :new.day='sunday' then
6 raise_application_error(-20121,'operation not allowed');
7 end if;
8 end;
9 /
Trigger created.
SQL> create or replace trigger mbmb_tri
2 before insert on christo4
3 for each row
4 begin
5 if:new.day='saturday' or :new.day='sunday' then
7/27/2019 Vb Vc++ Oracle practical programs
81/86
81
6 raise_application_error(-20121,'operation not allowed');
7 end if;
8 end;
9 /
Trigger created.
SQL> insert into christo4 values(100,212,'sunday');
insert into christo4 values(100,212,'sunday')
*
ERROR at line 1:
ORA-20121: operation not allowed
ORA-06512: at "SCOTT.MBMB_TRI", line 3
ORA-04088: error during execution of trigger 'SCOTT.MBMB_TRI'
SQL> create or replace trigger deltri
2 before delete on christo4
3 for each row
4 begin
5 if deleting then
6 raise_application_error(-20022,'sorry deleting not allowed');
7 end if;
8 end;
9 /
Trigger created.
7/27/2019 Vb Vc++ Oracle practical programs
82/86
82
SQL> delete from christo4;
delete from christo4
*
ERROR at line 1:
ORA-20022: sorry deleting not allowed
ORA-06512: at "SCOTT.DELTRI", line 3
ORA-04088: error during execution of trigger 'SCOTT.DELTRI'
Result:
Thus the above queries has been executed and verified successfully.
7/27/2019 Vb Vc++ Oracle practical programs
83/86
83
AIM:
To write a program to create table by using student database management system,
ALGORITHM:
Step1: Start the process.
Step2: Design the front-end for student database management system using visual
basic 6.0.
Step3: Create a table in back-end for student database management system using
oracle.
Step4: Provide the connectivity using ADO and establish the connection.
Step5: Perform operation such as insert, update and delete.
Step6: Stop the process.
EX.NO: 6 STUDENT DATABASE MANAGEMENT SYSTEM
DATE:03.09.13
7/27/2019 Vb Vc++ Oracle practical programs
84/86
84
FORM DESIGN:
7/27/2019 Vb Vc++ Oracle practical programs
85/86
85
SOURCE CODE:
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.Delete
Adodc1.Refresh
End Sub
Private Sub Command3_Click()
Adodc1.Recordset.Update
Adodc1.Refresh
End Sub
Private Sub Command4_Click()
End
End Sub
7/27/2019 Vb Vc++ Oracle practical programs
86/86
OUTPUT: