DMS4
DMS4
Micro Project
Report on
“Describe View,
Sequence, Function
And Procedure”
In the fulfillment of the
requirement for Diploma in
Computer Engineering
Submitted by
Guided By
1
MAHARASHTRA STATE BOARD OF
TECHNICAL
EDUCATION,MUMBAI.
CERTIFICATE
2
Principal (Guided By)
(H.O.D
3
Evalution Sheet For Micro Project: -
Academic Year:-2022-2023 Sub & Sub Code:-DMS(22316)
Semester: - 3rd
Pos:-
users Cos:-
4
Weekly Progress Report
5
Group Details:-
6
Index
1. Introduction
2. What Is View,View 7
Syntax & Example
3. What Is 8
Sequence,Sequence
Syntax & Example
4. What Is 9
Function,Function
Syntax & Example
5. What Is Procedure 11
6. Conclusion 14
7
Views In DBMS
A view is a virtual table that consists of columns from one or more tables.
A virtual table is like a table containing fields but it does not contain any
data.
In run time it contains the data and after that it gets free. But table
stores the data in database occupy some space.
Just like table, view contains Rows and Columns which is fully
virtual based table.
Views are usually virtual and do not occupy space in systems.
Views can be used as security mechanism
There is no record in the view it only holds the definition of table and
fetches data from the table and shows it.
We can create a view by selecting fields from one or more tables
present in the database.
A View can either have all the rows of a table or specific rows based on
certain condition.
Example
8
Sequence:-
Syntax:
CREATE SEQUENCE
sequence_name START WITH
initial_value INCREMENT BY
increment_value MINVALUE
minimum value MAXVALUE
maximum value CYCLE|
Sequence_name: Name of the sequence.
9
Example:-
Following is the sequence query creating sequence in ascending order.
Function:-
1
0
BEGIN
< function_body >
END
[function_name];
•
• PL/SQL Drop Function
Functions Drop Syntax
DROP FUNCTION
function_name; DROP
FUNCTION adder;
return number
is
n3 number(8);
begin
n3 :=n1+n2;
return n3;
end;
/
1
1
Now write another program to call the function
DECLARE
n3 number(2);
• BEGIN
n3 := adder(11,22);
dbms_output.put_line('Addition is: ' || n3);
END;
/
Output:-
Addition is: 33
Statement
processed
1
2
Procedures
:
• Header:- The header contains the name of the procedure and the
parameters or variables passed to the procedure.
Procedure Example:-
• In this example, we are going to insert record in user table. So you
need to create user table first.
• create table user(id number(10) primary key,name varchar2(100));
• Now write the procedure code to insert record in user table.
Procedure Code:
create or replace procedure
"INSERTUSER" (id IN NUMBER,name IN
VARCHAR2)
is
begi
n
1
3
insert into user values(id,name);
1
4
end; /
• Output:-
Procedure created.
1
5
Conclusio
n
1
6