*/ /* This is the only section of the block that is required.*/ EXCEPTION /* Exception handling section: error handling statements go here. The executable section also contains constructs such as assignments, branches, loops, procedure calls, and triggers, which are all described below. C style comments ( or by putting the code in a file and invoking the file in the various ways we learned in Getting Started With Oracle. PL/SQL extends SQL by adding constructs found in procedural languages, resulting in a structural language that is more powerful than SQL. All PL/SQL programs are made up of blocks, which can be nested within each other.Typically, each block performs a logical action in he program.If there is any type mismatch, variable assignments and comparisons may not work the way you expect.To be safe, instead of hard coding the type of a variable, you should use the This program has no effect when run, because there are no changes to the database.In real life scenarios, AFTER UPDATE Trigger mostly used for Data Logging in audit table. Creating an AFTER UPDATE statement trigger on the employee_salary table that itself issues an UPDATE statement on employee_salary, causes the trigger to fire recursively until it has run out of memory. In this example we have created a trigger which will insert rows into audit table after each update on SALARY column of employee_salary table.Whenever user will update data of SALARY column in employee_salary table, the data row from employee_salary table will also be inserted into employee_salary_log by Trigger. Then we will create audit table employee_salary_log.
Whenever user will update data of SALARY column in employee_salary table with hike greater than 50000, the data row from employee_salary table will also be inserted into employee_salary_hike_log by Trigger.
First, we will create table employee_salary same as first example.
Then we will create audit table employee_salary_hike_log.
Information is transmitted between a PL/SQL program and the database through variables. In many cases, a PL/SQL variable will be used to manipulate data stored in a existing relation.
Every variable has a specific type associated with it. In this case, it is essential that the variable have the same type as the relation column.