You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by jt...@apache.org on 2005/06/23 23:42:17 UTC

svn commit: r201501 - /incubator/derby/docs/trunk/src/ref/rrefsqlj81859.dita

Author: jta
Date: Thu Jun 23 14:42:17 2005
New Revision: 201501

URL: http://svn.apache.org/viewcvs?rev=201501&view=rev
Log:
DERBY-126 Committed Jeff Levitt's patch that corrects documentation about
column defaults.

Modified:
    incubator/derby/docs/trunk/src/ref/rrefsqlj81859.dita

Modified: incubator/derby/docs/trunk/src/ref/rrefsqlj81859.dita
URL: http://svn.apache.org/viewcvs/incubator/derby/docs/trunk/src/ref/rrefsqlj81859.dita?rev=201501&r1=201500&r2=201501&view=diff
==============================================================================
--- incubator/derby/docs/trunk/src/ref/rrefsqlj81859.dita (original)
+++ incubator/derby/docs/trunk/src/ref/rrefsqlj81859.dita Thu Jun 23 14:42:17 2005
@@ -1,4 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE reference PUBLIC "-//IBM//DTD DITA Reference//EN"
+ "../dtd/reference.dtd">
 <!-- 
 Copyright 1997, 2004 The Apache Software Foundation or its licensors, as applicable.  
 
@@ -14,9 +16,6 @@
 See the License for the specific language governing permissions and  
 limitations under the License.
 -->
-
-<!DOCTYPE reference PUBLIC "-//IBM//DTD DITA Reference//EN"
- "../dtd/reference.dtd">
 <reference id="rrefsqlj81859" xml:lang="en-us">
 <title>ALTER TABLE statement</title>
 <prolog><metadata>
@@ -24,6 +23,9 @@
 tables</indexterm><indexterm>Tables<indexterm>altering</indexterm><indexterm>compressing</indexterm></indexterm>
 <indexterm>Columns<indexterm>adding</indexterm></indexterm><indexterm>Constraints<indexterm>adding</indexterm><indexterm>dropping</indexterm><indexterm
 >compressing</indexterm></indexterm><indexterm>Defaults<indexterm>adding</indexterm><indexterm>dropping</indexterm></indexterm>
+<indexterm>Adding Columns</indexterm><indexterm>Adding Constraints</indexterm>
+<indexterm>Dropping Constraints</indexterm><indexterm>Defaults<indexterm>setting</indexterm></indexterm>
+<indexterm>Tables<indexterm>changing lock granularity for</indexterm></indexterm>
 </keywords>
 </metadata></prolog>
 <refbody>
@@ -34,7 +36,7 @@
 <li>increase the width of a VARCHAR, CHAR VARYING, and CHARACTER VARYING column</li>
 <li>override row-level locking for the table (or drop the override)</li>
 </ul></p></section>
-<section><title>Syntax</title> <codeblock><b>ALTER TABLE <i><xref href="rreftablename.dita#rreftablename"></xref></i>
+<section><title>Syntax</title><codeblock><b>ALTER TABLE <i><xref href="rreftablename.dita#rreftablename"></xref></i>
 {
     ADD COLUMN <i><xref href="rrefaltercolumndef.dita#rrefaltercolumndef"></xref></i> |
     ADD <i><xref href="rrefsqlj13590.dita#rrefsqlj13590"></xref></i> |
@@ -43,24 +45,23 @@
     ALTER <i><xref href="rrefsqlj37860.dita#rrefsqlj37860"></xref></i> |
     LOCKSIZE { ROW | TABLE }
 }</b></codeblock></section>
-<section><title>Adding columns</title> <p><indexterm>Adding Columns</indexterm>The
-syntax for the <i><xref href="rrefsqlj30540.dita#rrefsqlj30540"></xref></i> for
+<section><title>Adding columns</title><p>The syntax for the <i><xref href="rrefsqlj30540.dita#rrefsqlj30540"></xref></i> for
 a new column is the same as for a column in a CREATE TABLE statement. This
 means that a column constraint can be placed on the new column within the
 ALTER TABLE ADD COLUMN statement. However, a column with a NOT NULL constraint
 can be added to an existing table only if the table is empty or if you give
 a default value; otherwise, an exception is thrown when the ALTER TABLE statement
-is executed. </p> <p>Just as in CREATE TABLE, if the column definition includes
+is executed. </p><p>Just as in CREATE TABLE, if the column definition includes
 a unique or primary key constraint, the column cannot contain null values,
-so the NOT NULL attribute must also be specified (SQLSTATE 42831).</p> <note>If
+so the NOT NULL attribute must also be specified (SQLSTATE 42831).</p><note>If
 a table has an UPDATE trigger without an explicit column list, adding a column
 to that table in effect adds that column to the implicit update column list
 upon which the trigger is defined, and all references to transition variables
 are invalidated so that they pick up the new column.</note></section>
-<section><title>Adding constraints</title> <p><indexterm>Adding Constraints</indexterm>ALTER
-TABLE ADD CONSTRAINT adds a table-level constraint to an existing table. Any
-supported table-level constraint type can be added via ALTER TABLE. The following
-limitations exist on adding a constraint to an existing table:   <ul>
+<section><title>Adding constraints</title><p>ALTER TABLE ADD CONSTRAINT adds
+a table-level constraint to an existing table. Any supported table-level constraint
+type can be added via ALTER TABLE. The following limitations exist on adding
+a constraint to an existing table:   <ul>
 <li>When adding a foreign key or check constraint to an existing table, <ph
 conref="refconrefs.dita#prod/productshortname"></ph> checks the table to make
 sure existing rows satisfy the constraint. If any row is invalid, <ph conref="refconrefs.dita#prod/productshortname"></ph> throws
@@ -71,55 +72,48 @@
 in the definition of column C, the effect is the same as if the PRIMARY KEY(C)
 clause were specified as a separate clause. The column cannot contain null
 values, so the NOT NULL attribute must also be specified.</p></li>
-</ul></p></section>
-<section><title>Dropping constraints</title> <p><indexterm>Dropping
-Constraints</indexterm>ALTER TABLE DROP CONSTRAINT drops a constraint on an
-existing table. To drop an unnamed constraint, you must specify the generated
-constraint name stored in <i>SYS.SYSCONSTRAINTS</i> as a delimited identifier.</p></section>
-<section><title>Errors</title> <p>For information on the syntax of constraints,
-see <xref href="rrefsqlj13590.dita#rrefsqlj13590"></xref>. Use the syntax
-for table-level constraint when adding a constraint with the ADD TABLE ADD
-CONSTRAINT syntax.</p></section>
-<section><title>Purpose</title> <p>Dropping a primary key, unique, or foreign
-key constraint drops the physical index that enforces the constraint (also
-known as a <i>backing index</i>).</p></section>
-<section><p>The <i><xref href="rrefsqlj37860.dita#rrefsqlj37860"></xref></i> allows
+</ul></p><p>For information on the syntax of constraints, see <xref href="rrefsqlj13590.dita#rrefsqlj13590"></xref>.
+Use the syntax for table-level constraint when adding a constraint with the
+ADD TABLE ADD CONSTRAINT syntax.</p></section>
+<section><title>Dropping constraints</title><p>ALTER TABLE DROP CONSTRAINT
+drops a constraint on an existing table. To drop an unnamed constraint, you
+must specify the generated constraint name stored in <i>SYS.SYSCONSTRAINTS</i> as
+a delimited identifier.</p><p>Dropping a primary key, unique, or foreign key
+constraint drops the physical index that enforces the constraint (also known
+as a <i>backing index</i>).</p></section>
+<section><title>Modifying columns</title><p>The <i><xref href="rrefsqlj37860.dita#rrefsqlj37860"></xref></i> allows
 you to alter the named column in the following ways:   <ul>
 <li>Increasing the length of an existing VARCHAR column. CHARACTER VARYING
 or CHAR VARYING can be used as synonyms for the VARCHAR keyword. <p>To increase
 the width of a column of these types, specify the data type and new size after
-the column name.</p> <p>You are not allowed to decrease the width or to change
+the column name.</p><p>You are not allowed to decrease the width or to change
 the data type. You are not allowed to increase the width of a column that
 is part of a primary or unique key referenced by a foreign key constraint
 or that is part of a foreign key constraint.</p></li>
-<li>Specifying the interval between consecutive values of the identity column.</li>
-<li>To set an interval between consecutive values of the identity column,
-specify the integer-constant.</li>
-<li>You must previously define the column with the IDENTITY attribute (SQLSTATE
-42837).</li>
+<li>Specifying the interval between consecutive values of the identity column.<p>To
+set an interval between consecutive values of the identity column, specify
+the integer-constant. You must previously define the column with the IDENTITY
+attribute (SQLSTATE 42837). If there are existing rows in the table, the values
+in the column for which the SET INCREMENT default was added do not change.</p></li>
 </ul></p></section>
-<section><title>Messages</title> <p><indexterm>Defaults<indexterm>setting</indexterm></indexterm>You
-can specify a default value for a new column. A default value is the value that is inserted into a column
+<section><title>Setting defaults</title><p>You can specify a default value
+for a new column. A default value is the value that is inserted into a column
 if no other value is specified. If not explicitly specified, the default value
 of a column is NULL. If you add a default to a new column, existing rows in
-the table gain the default value in the new column.</p> <p>You can set the interval between consecutive values
-of the identity column to an existing column in a table. If there are existing
-rows in the table, the values in the column for which the SET INCREMENT default
-was added do not change. Note that this means that values in the column are
-not guaranteed to be unique (use a unique or primary key constraint to guarantee
-uniqueness).</p> <p>For more information about defaults, see <xref href="rrefsqlj24513.dita#rrefsqlj24513"></xref>.</p></section>
-<section><title>Defaults</title> <p><indexterm>Tables<indexterm>changing lock
-granularity for</indexterm></indexterm>The LOCKSIZE clause allows you to override
-row-level locking for the specific table, if your system uses the default
-setting of row-level locking. (If your system is set for table-level locking,
-you cannot change the locking granularity to row-level locking, although <ph
-conref="refconrefs.dita#prod/productshortname"></ph> allows you to use the
-LOCKSIZE clause in such a situation without throwing an exception.) To override
-row-level locking for the specific table, set locking for the table to TABLE.
-If you created the table with table-level locking granularity, you can change
-locking back to ROW with the LOCKSIZE clause in the ALTER TABLE STATEMENT.
-For information about why this is sometimes useful, see <cite><ph conref="refconrefs.dita#pub/cittuning"></ph></cite>.</p></section>
-<section><title>Examples</title> <codeblock><b><ph>-- Add a new column with a column-level constraint
+the table gain the default value in the new column.</p><p>For more information
+about defaults, see <xref href="rrefsqlj24513.dita#rrefsqlj24513"></xref>.</p></section>
+<section><title>Changing the lock granularity for the table</title><p>The
+LOCKSIZE clause allows you to override row-level locking for the specific
+table, if your system uses the default setting of row-level locking. (If your
+system is set for table-level locking, you cannot change the locking granularity
+to row-level locking, although <ph conref="refconrefs.dita#prod/productshortname"></ph> allows
+you to use the LOCKSIZE clause in such a situation without throwing an exception.)
+To override row-level locking for the specific table, set locking for the
+table to TABLE. If you created the table with table-level locking granularity,
+you can change locking back to ROW with the LOCKSIZE clause in the ALTER TABLE
+STATEMENT. For information about why this is sometimes useful, see <cite><ph
+conref="refconrefs.dita#pub/cittuning"></ph></cite>.</p></section>
+<section><title>Examples</title><codeblock><b><ph>-- Add a new column with a column-level constraint
 -- to an existing table
 -- An exception will be thrown if the table
 -- contains any rows
@@ -160,10 +154,9 @@
 ALTER TABLE SAMP.EMP_PHOTO ALTER PHOTO_FORMAT SET DATA TYPE VARCHAR(30);
 <ph>-- change the lock granularity of a table</ph>
 ALTER TABLE SAMP.SALES LOCKSIZE TABLE;</b></codeblock></section>
-<section><title>Results</title> <p>An ALTER TABLE statement causes all statements
+<section><title>Results</title><p>An ALTER TABLE statement causes all statements
 that are dependent on the table being altered to be recompiled before their
 next execution. ALTER TABLE is not allowed if there are any open cursors that
 reference the table being altered.</p></section>
 </refbody>
 </reference>
-