How to update value for multiple field in oracle sql?

Member

by rollin , in category: Third Party Scripts , a month ago

How to update value for multiple field in oracle sql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by lindsey.homenick , a month ago

@rollin 

To update values for multiple fields in Oracle SQL, 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 names of the columns you want to update.
  • value1, value2, value3, etc. are the values you want to set for each column.
  • condition is an optional clause that specifies which rows should be updated.


For example, if you have a table called employees and you want to update the salary, department, and location columns for employees with an employee_id of 100, you can use the following SQL statement:

1
2
3
UPDATE employees
SET salary = 60000, department = 'Sales', location = 'New York'
WHERE employee_id = 100;


This will update the salary, department, and location columns for the employee with an employee_id of 100 in the employees table.