The ALTER TABLE statement, issued with an ADD COLUMN clause, lets you add a column to an existing relational table. A table contains up to 100 columns.
Note: You can use host variables for tablename and colname.
ADDRESS SQL "ALTER TABLE keywords" {tablename}
ADD COLUMN
{colname}
{datatype}
[DEFAULT string|NULL]
[UPPER CASE]
[NOT NULL]
[SYSTEM(ALL|EXT|sysnames)]
[SYSWAIT(seconds)]
[OUTPUT|NOOUTPUT]
[SYSPLEX]
[SUBSYS(subsystem)]
OPSQL ALTER TABLE {tablename}
ADD COLUMN
{colname}
{datatype}
[DEFAULT 'string'|NULL]
[UPPER CASE]
[NOT NULL]
Defines the name of the relational table to which you are adding a column.
Limits: 1-18-character-length log name
Defines the name of the column that you are adding.
Limits: 1-18-character-length log name
Defines the type of data that the column stores.
Data types include:
Specifies character data, with length as the fixed number of characters you want this column to store.
Note: We recommend using data type CHAR for most purposes. If the length of the stored data differs from row to row, and the full potential column length is seldom used, use VARCHAR. CHAR and VARCHAR are processed more efficiently than other data types.
Specifies the date, in the format yyyy-mm-dd.
Example: 1994-07-25
Specifies decimal data
Limits: 1-15 digits
Specifies hexadecimal data, with length as the maximum number of hexadecimal bytes this column stores.
Specifies full-word integer data.
Limits: maximum value of 2147483647
Specifies half-word integer data.
Limits: maximum value of 32767
Specifies the time, in the format hh:mm:ss.nnn.
Example: 13:21:53.876
Note: If a value for length is not specified, the default value is 8.
Specifies date and time, in a format that combines the DATE and TIME formats.
Note: If a value for length is not specified, the default value is 20.
Specifies character data; length represents the maximum number of characters this column stores.
Notes:
Example: WHERE UPDATE = DATE '1994-04-27'
(Optional) Indicates that the string is a default value to be set for this column, if an INSERT statement does not provide a data value.
Notes:
The default string can be either a character string or a numeric string.
If you are using the OPSQL command processor to invoke the ALTER TABLE statement, enclose the value of the string in single quotes.
(Optional) Indicates that the column can contain no data. NULL is the default.
(Optional) The UPPER CASE keyword in a column definition specifies that the column can contain only uppercase characters. UPPER CASE also instructs SQL to convert any lowercase value in that column to uppercase.
(Optional) Indicates that the new column cannot contain a null data value.
(Optional) Performs cross-system SQL operations. Specify one of the following values:
Routes the SQL command to all active MSF-defined systems, including the local system.
Routes the SQL command to all remote, active MSF-defined systems.
Routes the SQL command to the specified systems. You may specify from one to eight system names as the value of sysnames.
Note: For more information about the SYSTEM keyword, see the User Guide.
(Optional) Defines the number of seconds the SQL processor waits for output from a remote system.
Limits: 1-300 seconds.
Note: Do not specify a value for SYSWAIT if you specify the SYSTEM(ALL), SYSTEM(EXT), or NOOUTPUT keywords.
(Optional) Indicates whether the command returns output to the external data queue. To have output returned, specify OUTPUT; otherwise, specify NOOUTPUT.
NOOUTPUT is implied when:
(Optional) Reduces the scope of the SYSTEM(ALL|EXT) operand to MSF connected systems that belong to the same z/OS sysplex as the command issuer. The keyword has no effect on a list of explicit system names.
(Optional) Performs SQL operations on other CA OPS/MVS subsystems that are in communication with the current one. Specify the following value:
Routes the SQL command to the specified subsystem. You can use only one four-character name of the subsystem as follows: OPSx.
Example: Add a Table Column
Add an eight-character column called OPERNAME
ADDRESS SQL "ALTER TABLE SYSTEMS ADD COLUMN OPERNAME CHAR(8) NOT NULL"
|
Copyright © 2014 CA Technologies.
All rights reserved.
|
|