How to update multiple values in oracle?

by raven_corwin , in category: MySQL , 2 months ago

How to update multiple values in oracle?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lottie , 2 months ago

@raven_corwin 

To update multiple values in Oracle, you can use the following syntax:

1
2
3
UPDATE table_name
SET column1 = value1, column2 = value2, column3 = value3
WHERE condition;


In this syntax:

  • table_name is the name of the table you want to update.
  • column1, column2, column3, etc. are the columns you want to update.
  • value1, value2, value3, etc. are the new values you want to set for the columns.
  • condition is the condition that specifies which rows to update. This is optional, if not specified, all rows in the table will be updated.


For example, if you have a table named employees and you want to update the salary and department columns for employees who have a job_title of 'Manager', you can use the following query:

1
2
3
UPDATE employees
SET salary = 60000, department = 'Management'
WHERE job_title = 'Manager';


This will update the salary and department values for all employees who have a job_title of 'Manager' in the employees table.