Difference between revisions of "Update Command"

From rbachwiki
Jump to navigation Jump to search
Line 14: Line 14:
  SET region = 'W'
  SET region = 'W'
  WHERE region IN ('NE', 'NW')
  WHERE region IN ('NE', 'NW')
== Update Multiple Columns ===
UPDATE acctmanager
SET amedate = '10-OCT-09',
    region = 'S'
WHERE amid = 'J500'
== Using Substituion Variables ==
'''A substitution variable in an SQL command instructs Oracle 11g to substitute a value in place of the variable at the time the command is actually executed. To include a substitution variable in an SQL command, simply enter an ampersand (&) followed by the name used for the variable.'''




[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]]
[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]]

Revision as of 13:59, 18 October 2017

Update Command

Used to change the contents of existing rows

  • The UPDATE clause identifies the table containing the records to be changed.
  • The SET clause identifies the columns to be changed and the new values to be assigned to these columns.
  • The optional WHERE clause identifies the exact records to be changed by the UPDATE command. If the WHERE clause is omitted, the column specified in the SET clause is updated for all records in the table.
UPDATE acctmanager
SET amedate = '01-AUG-09'
WHERE amid = 'J500';

Change multiple records that match a criteria

All records that have NE and NW will be changed to W

UPDATE acctmanager 
SET region = 'W'
WHERE region IN ('NE', 'NW')

Update Multiple Columns =

UPDATE acctmanager
SET amedate = '10-OCT-09',
    region = 'S'
WHERE amid = 'J500'

Using Substituion Variables

A substitution variable in an SQL command instructs Oracle 11g to substitute a value in place of the variable at the time the command is actually executed. To include a substitution variable in an SQL command, simply enter an ampersand (&) followed by the name used for the variable.


Back To Top- Home - Category