Examples of PL/SQL RENAME VIEW
To show the procedure of building a view in PL/ SQL, let`s suppose that we have an employees table.
EmployeeID | FirstName | LastName | Department |
---|---|---|---|
1 | John | Doe | Engineering |
2 | Jane | Smith | Marketing |
3 | David | Brown | Finance |
1 | John | Doe | Engineering |
2 | Jane | Smith | Marketing |
3 | David | Brown | Finance |
let’s create a view named employee_view that displays the first name, last name, department, and salary of employees:
CREATE OR REPLACE VIEW employee_view AS
SELECT first_name, last_name, department, salary
FROM employees;
Output:
first_name | last_name | department | salary |
---|---|---|---|
John | Doe | Engineering | NULL |
Jane | Smith | Marketing | NULL |
David | Brown | Finance | NULL |
John | Doe | Engineering | NULL |
Jane | Smith | Marketing | NULL |
David | Brown | Finance | NULL |
PL/SQL RENAME VIEW
PL/SQL which is Oracle Corporation’s extension of SQL with a procedural language enables developers and database administrators to carry out complex operations in the databases. One of the frequently performed operations in the process of database maintenance is the change of names of objects to accomplish better organization and clarity.
In this guide, we will focus on changing the names of views in PL/SQL as well as analyze their significance, syntax, and best practices.