background image
<< SET SCHEMA statement | Statement dependency system >>

TRUNCATE TABLE statement

<< SET SCHEMA statement | Statement dependency system >>
Derby Reference Manual
73
ps.setString(1,"HOTEL");
ps.executeUpdate();
... do some work
ps.setString(1,"APP");
ps.executeUpdate();
ps.setString(1,"app"); //error - string is case sensitive
// no app will be found
ps.setNull(1, Types.VARCHAR); //error - null is not allowed
TRUNCATE TABLE statement
The TRUNCATE TABLE statement allows you to quickly remove all content from the
specified table and return it to its initial empty state.
To truncate a table, you must either be the
database owner
or the table owner.
You cannot truncate system tables or global temporary tables with this statement.
Syntax
TRUNCATE TABLE
table-Name
Examples
To truncate the entire
Flights
table, use the following statement:
TRUNCATE TABLE Flights;
UPDATE statement
Syntax
{
UPDATE
table-Name
[[AS] correlation-Name]
SET
column-Name
= Value
[ ,
column-Name
= Value} ]*
[
WHERE clause
] |
UPDATE
table-Name
SET
column-Name
= Value
[ ,
column-Name
= Value ]*
WHERE CURRENT OF
}
where Value is defined as follows:
Expression | DEFAULT
The first syntactical form, called a searched update, updates the value of one or more
columns for all rows of the table for which the WHERE clause evaluates to TRUE.
The second syntactical form, called a positioned update, updates one or more columns
on the current row of an open, updatable cursor. If columns were specified in the
FOR
UPDATE clause
of the SELECT statement used to generate the cursor, only those
columns can be updated. If no columns were specified or the select statement did not
include a FOR UPDATE clause, all columns may be updated.
Specifying DEFAULT for the update value sets the value of the column to the default
defined for that table.
The DEFAULT literal is the only value which you can directly assign to a generated
column. Whenever you alter the value of a column referenced by the generation-clause
of a generated column, Derby recalculates the value of the generated column.
Example