Updating salary for different departments using cursor
25-Sep-2019 23:54
For information on the use of PL/SQL records with SQL to update and insert data, see "Inserting PL/SQL Records into the Database" and "Updating the Database with PL/SQL Record Values".
For additional information on assigning values to PL/SQL variables, see "Assigning a SQL Query Result to a PL/SQL Variable".
In addition to static SQL discussed in this chapter, PL/SQL also supports dynamic SQL, which enables you to execute SQL data definition, data control, and session control statements dynamically.
Previous post we have explained detailed about different types of cursors.
At the end of a transaction that makes database changes, Oracle makes all the changes permanent or undoes them all.
If your program fails in the middle of a transaction, Oracle detects the error and rolls back the transaction, restoring the database to its former state. However, there are limitations on the use of pseudocolumns, including the restriction on the use of some pseudocolumns in assignments or conditional tests.
You might use sequence numbers to give each row a unique identifier, and refer to those identifiers from other rows to set up parent-child relationships. PL/SQL declares a cursor implicitly for all SQL data manipulation statements, including queries that return only one row.
If you want precise control over query processing, you can declare an explicit cursor in the declarative part of any PL/SQL block, subprogram, or package.
( Note:- Only 3 departments has employees, so total 6 employees shown in the output ) When writing nested cursor make sure 1.