Skip to content
Advertisement

Rows not updated in PL/SQL

I want to update user’s salaries in a given department by 10K if they have T in their names otherwise n*10k where n is the saraly category which is from 1 to 5. But somehow Update query is not updating the rows.

I create a cursor, and fetch them into rec variable. And then check if the name has ‘T’, otherwise I set inc variable to salary category and update the row appropriately.

The result which is wrong Salary category TABLE Employees TABLE

Advertisement

Answer

You don’t need a PL/SQL Block. Only using a single Update statement is enough :

where an employees’ salary will have a coefficient equals to 1, if his name contain a letter T

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement