Database and PLSQL Concepts
Database and PLSQL Concepts
Purpose:
A database is designed to store, manage, and retrieve structured data efficiently. It ensures:
Example:
- Product information
- Customer details
1. Hierarchical Model:
Example: Employee -> Department -> Project. Each department has employees, and each
2. Network Model:
Similar to hierarchical, but allows multiple relationships (many-to-many).
Example: A project can have many employees, and an employee can work on multiple projects.
3. Relational Model:
Data is stored in tables with rows and columns. Relationships are defined by foreign keys.
4. Object-oriented Model:
Data is stored as objects, similar to OOP. Supports complex data types like multimedia, images, etc.
1. Oracle Real Application Clusters (RAC): Enables multiple servers to access the same database.
In a personal database system (e.g., Microsoft Access), only one user typically accesses the
database. In a multiuser environment, like Oracle, the database is accessed by many users
- Concurrency Control: Ensures data consistency when many users access data.
- Transaction Management: Makes sure changes are either fully completed or not applied.
DECLARE
emp_name employees.name%TYPE;
emp_salary employees.salary%TYPE;
BEGIN
OPEN emp_cursor;
LOOP
END LOOP;
CLOSE emp_cursor;
END;
INSERT INTO employees (employee_id, name, department) VALUES (104, 'Anil', 'HR');
DECLARE
BEGIN
END LOOP;
END;
END employee_pkg;
BEGIN
END;
emp_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO emp_salary FROM employees WHERE employee_id = emp_id;
RETURN emp_salary;
END;
END employee_pkg;