Chapter 9 SQL Statements
639
SET JProd.setName( ’Tank Top’ )
FROM clause The optional FROM clause allows tables to be updated
based on joins. If the FROM clause is present, the WHERE clause qualifies
the rows of the FROM clause. Data is updated only in the table list of the
UPDATE clause.
If a FROM clause is used, it is important to qualify the table name the same
way in both parts of the statement. If a correlation name is used in one place,
the same correlation name must be used elsewhere. Otherwise, an error is
generated.
This clause is allowed only if ANSI_UPDATE_CONSTRAINTS is set to
OFF. See "ANSI_UPDATE_CONSTRAINTS option" on page 171.
$ For a full description of joins, see "Joins: Retrieving Data from Several
Tables" on page 195 of the book ASA User’s Guide.
$ For more information, see "FROM clause" on page 532.
WHERE clause If a WHERE clause is specified, only rows satisfying the
search condition are updated. If no WHERE clause is specified, every row is
updated.
ORDER BY clause Normally, the order in which rows are updated does
not matter. However, in conjunction with the FIRST or TOP clause the order
can be significant.
You must not update columns that appear in the ORDER BY clause unless
you set the ANSI_UPDATE_CONSTRAINTS option to OFF. See
"ANSI_UPDATE_CONSTRAINTS option" on page 171.
Case sensitivity Character strings inserted into tables are always stored in
the same case as they are entered, regardless of whether the database is case
sensitive or not. A CHAR data type column updated with a string Value is
always held in the database with an upper case V and the remainder of the
letters lower case. SELECT statements return the string as Value. If the
database is not case sensitive, however, all comparisons make Value the
same as value, VALUE, and so on. Further, if a single-column primary key
already contains an entry Value, an INSERT of value is rejected, as it would
make the primary key not unique.
Updates that leave a row unchanged If the new value does not differ
from the old value, no change is made to the data. However, BEFORE
UPDATE triggers fire any time an UPDATE occurs on a row, whether or not
the new value differs from the old value. AFTER UPDATE triggers fire only
if the new value is different from the old value.