Professional Documents
Culture Documents
Oracle
Introduction to Oracle
The oracle corporation is the worlds leading supplier of software for information management and worlds second largest independent software company. Oracle is the top selling multi user RDBMS. Oracle application covers business intelligence, ecommerce, financials, human resources, manufacturing, mobile, project, and sales.
Features of Oracle
Client/Server Architecture Large database and space management Concurrent Processing
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
High transaction processing performance High Availability Controlled availability Openness industry standards Manageable security Database enforced integrity Distributed system Portability Compatibility Replicated environment
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
SQL
Introduction to SQL
SQL stands for Structured Query Language. SQL is a simple and powerful language used to create access and manipulate data and structure in the database. SQL is like plain English, which is easy to understand and to write. The history of SQL begins in an IBM laboratory in San Jose, California, where SQL was developed in the late 1970s. The initials stand for Structured Query Language, and the language itself is often referred to as "sequel." It was originally developed for IBM's DB2 product (a relational database management system, or RDBMS, that can still be bought today for various platforms and environments). In fact, SQL makes an RDBMS possible. SQL is a nonprocedural language, in contrast to the procedural or third-generation languages (3GLs) such as COBOL and C that had been created up to that time. SQL is the de facto standard language used to
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
manipulate and retrieve data from these relational databases. SQL enables a programmer or database administrator to do the following:
Modify a database's structure Change system security settings Add user permissions on databases or tables Query a database for information Update the contents of a database
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
Sr.No
1. 2. 3. 4. 5.
Rename schema objects Grant and take away privileges And rights
6.
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
2. Data Manipulation Language statements: - Once the tables have been created, the DML statements enable users to query or manipulate data in existing schemas objects. DML statements are normally the most frequently used commands. The following table gives an overview about DML statements:
Sr.No
1.
2.
insert
3.
select
update
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
3. Transaction Control Language statements: - TCL statements manage the Changes made by DML statements and group DML statements into transaction. The Following table gives an overview about TCL
Sr.No
1.
2.
Undo changes in a transaction Either since the transaction started Or since a savepoint
rollback
3.
savepoint
4.
set transaction
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
Data Types
The information in a database is maintained in the form of table and each table consist of rows and columns, which store data and therefore this data must have some data type i.e. the type of data, which is stored in a table. The different data types available in oracle are:
Data Types
Vachar2 Char Number Date Raw Long
Description
Contains variable length text string of up to 2000 bytes Contains fixed text strings of up to 255 bytes Contains numeric data Contains date data Contains binary data up to 255 bytes Contains text data of up to 2gigabytes
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
10
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
11
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
12
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
13
14
We can link columns to other columns, arithmetic expressions, or constant values to create a character expression by using the concatenation operator.
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
15
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
16
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
17
Pattern Matching
The character pattern-matching operation is referred to as a wildcard search. You can select rows that match a character pattern using the like condition. The character pattern matching operation is referred to as a wildcard search. Two symbols can be used to construct the search string. % _ Represents any sequence of zero or more characters. Represents any single character
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
18
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
19
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
20
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
21
Sorting rows
The order of rows returned in a query is undefined. The order by clause can be used to sort the rows. If you use the order by clause it must be the last clause of the sql statement. You can specify an expression, or an alias or column position as the sort condition. In ascending order
In descending order
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
22
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
23
Table1.column1= Table2.column2
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
24
MIN Function
COUNT Function
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
25
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
26
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
27
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
28
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
29
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
30
Modifying a column
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
31
Dropping Tables
The drop table statement removes the definition of an oracle table. When you drop a table, the database loses all the data in the table and all the indexes associated with it.
All data is deleted from the table. Any views and synonyms remains but are invalid. Any pending transactions are committed .
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
32
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
33
Updating data
We can modify existing rows by using the update statement. The update statement modifies specific rows if the where clause is specified.
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
34
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
35
Deleting rows
We can remove existing rows by using the delete statement. We can delete specific rows by using the where clause in the delete statement.
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
36
Including constraints
The oracle server uses constraints to prevent invalid data entry into tables. We can use constraints to do the following: Enforce rules on the data in a table whenever a row is inserted, updated or deleted from that table. The constraint must be satisfied for the operation to succeed. Prevent the deletion of table if there are dependencies of other tables. Not Null: - The not null constraint ensures that the column contains no null values.
Unique: - A unique key integrity constraint requires that every value in a column be unique- that is, no two rows of a table can have duplicate values in a specified column.
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
37
Primary key: - A primary key constraint creates a primary key for the table. Only one primary key can be created for each table. The primary key constraint is a column that uniquely identifies each row in a table. A primary key column can not contain a null value.
Foreign key: - The foreign key constraint designates a column as a foreign key and establishes a relationship between a primary key or a unique key in the same table or a different table.
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
38
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
39
Views
A view is a virtual or logical table that allows the viewing or manipulating the contents of one or more tables. Views do not really contain or store data, but they take data from the tables on which they are based, called base tables.
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
40
Sequences
Oracle provides an object called a sequence that can generate unique numeric value. If the value entered in a column is computer generated it will always fulfill the unique constraint and the row will always be accepted for storage.
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
41
PL/SQL
Introduction to PL/SQL
PL/SQL is a procedure language that oracle developed as an extension to standard SQL in order to provide a way to execute procedure logic on the database. PL/SQL provide a mechanism for developer to add a procedure component at the server level PL/SQL is block structure language A PL/SQL block is a syntactically unit that might contain programmer code , variable declaration , error handler , procedure , function and even other PL/SQL block
42
End; In this syntax variable declaration are any variable that might want to define cursor definition and nested PL/SQL procedure and function are also define here program code refer to the PL/SQL statement that make up the block.
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
43
44
Programs
Program to calculate sum of two numbers
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
45
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
46
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
47
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
48
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
49
Procedures
Using local Procedures
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
50
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
51
Functions
Using local function
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
52
Cursors
The oracle engine uses a work area for its internal processing in order to execute an SQL statement this work area is private to SQL operation and is called cursor
Types of cursors
Implicit cursor: - The oracle engine implicitly opens a cursor on the server to process each SQL statement. Since the implicit cursor is opened and managed by oracle server internally the function of reversing an area in memory,
populating this area with appropriate data, processing the data in memory area, releasing the memory area when the processing is complete is taken care of by the oracle engine Explicit cursor: - When individual record in a table have to a process inside a PL/SQL block a cursor is used this cursor will be declared and mapped to an SQL query in declare section of the PLSQL block and used within its
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
53
executable section. A cursor thus created and used is known as an explicit cursor
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
54
Explicit cursor management This step involved in using an explicit cursor and manipulating data 1. Declare a cursor mapped to a SQL select statement that retrieves data for processing 2. Open the cursor 3. Fetch data from the cursor one row at a time into memory variables
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
55
4. Process the data held in the memory variables as required using a loop 5. Exit from the loop after processing is complete 6. Close the cursor Program to demonstrate implicit cursors
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
56
Triggers
Database trigger are data base object that are stored on the server. The oracle engine allows the definition of procedure that are implicitly executed when an insert, update or delete is issued against the table these procedure are called database trigger These data base object consist of the following distinct section 1. A named data base event 2. A PL/SQL block that executes when the event occurs
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
57
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
58
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
59
Packages
A package is an oracle object, which holds other objects with in it. Objects commonly held with in a package are procedures, functions, variables, constants, cursors and exception handlers. Package can contain PL/SQL block of code, which has been written to perform some process. PLSQL block of code do not require any kind of input from other PLSQL block of code. A package has two components. A specification and a body. A package specification declares the types, memory variables, constants, exceptions, cursors and sub programs that are available for use. A package body fully defines cursors, functions, procedures and thus implements the specification Creating package specification
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
60
Using packages
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com
61
It is only meant for Demo of Practical file of MCA-2nd Year (3rd Semester) Students. Nobody will copy it. Verified By: Rajan Manro For any query contact at: rajanmanro@rediffmail.com