Following is the syntax diagram for the valid SQL data types:
►►─┬─┬─ VARCHAR(length) ─┬─┬──────────────────┬──────────┬────────────────────►◄ │ └─ LONG VARCHAR ────┘ ├─ FOR MIXED DATA ─┤ │ │ ├─ FOR SBCS DATA ──┤ │ │ └─ FOR BIT DATA ───┘ │ ├─┬─ CHARACTER ─┬─┬────────────┬─┬──────────────────┬─┤ │ └─ CHAR ──────┘ └─ (length) ─┘ ├─ FOR MIXED DATA ─┤ │ │ ├─ FOR SBCS DATA ──┤ │ │ └─ FOR BIT DATA ───┘ │ ├─ FLOAT ─┬───────────────┬───────────────────────────┤ │ └─ (precision) ─┘ │ ├─┬─ NUMERIC ─┬─┬───────────────────────────────┬─────┤ │ ├─ DECIMAL ─┤ └─ (precision ─┬──────────┬─ ) ─┘ │ │ └─ DEC ─────┘ └─ ,scale ─┘ │ ├─┬─ INTEGER ─┬───────────────────────────────────────┤ │ └─ INT ─────┘ │ ├─ SMALLINT ──────────────────────────────────────────┤ ├─ REAL ──────────────────────────────────────────────┤ ├─ DOUBLE PRECISION ──────────────────────────────────┤ ├─ DATE ──────────────────────────────────────────────┤ ├─ TIME ──────────────────────────────────────────────┤ ├─ TIMESTAMP ─────────────────────────────────────────┤ ├─ GRAPHIC ─┬───────────────┬─────────────────────────┤ │ └─ (precision) ─┘ │ ├─ VARGRAPHIC(precision) ─────────────────────────────┤ └─ LONG VARGRAPHIC ───────────────────────────────────┘
The following are CA Datacom/DB extensions:
The following summarizes information about the valid SQL data types. See Data Types for more information.
Valid SQL Data Types:
CHARACTER or CHAR specifies a character string. The optional length must be an integer designating the number of characters in the string and must be enclosed in parentheses. The default value for the CHARACTER data type length is one byte.
VARCHAR specifies a varying-length character string of length 1 to maximum row size. The length is required, must be an integer designating the number of characters in the string, and must be enclosed in parentheses.
LONG VARCHAR specifies a varying-length character string whose maximum length is determined by the amount of space available in a block. Use of the LONG VARCHAR Data Type creates rows that are as long as the block size of the containing area. If LONG VARCHARs are to be used, this block size should be taken as the row size to be used in calculating the Log Area (LXX) block size (the block size of the longest block sized area containing LONG VARCHARs should be used).
Three semantic types are allowed: FOR MIXED DATA, FOR SBCS DATA, and FOR BIT DATA. FOR MIXED DATA means that DBCS characters are allowed in values stored in the column, in addition to EBCDIC (Single-Byte Character Set (SBCS)) characters. This is relevant when SQL is processing a value in the column, since it must recognize the Shift-Out and Shift-In characters that delimit DBCS substrings. FOR SBCS DATA means that DBCS characters are not allowed in the column. FOR BIT DATA means that the data is a string of binary data rather than a string of characters.
If a semantic type is not specified when the column is created, the default is the semantic type that was specified on the CXXMAINT OPTION=ALTER,DBCS=xx option. If xx was IS or FS, the default is FOR SBCS DATA. If xx was IM or FM, the default is FOR MIXED DATA.
Specifies a 64-bit floating-point number.
The optional precision of the number is the total number of digits. The precision can range from 1 to 15. The precision must be enclosed in parentheses.
Specifies a zoned decimal number.
The optional precision of the number is the total number of digits. The precision can range from 1 to 31. If you specify precision, you have the option of also specifying scale. The optional scale of the number is the number of digits to the right of the decimal point. The scale can range from 0 to the precision.
If you specify both precision and scale, you must separate them with a comma and enclose them in parentheses. When specifying a scale of zero, however, you can use (precision) for (precision,0). If you do not specify precision and/or scale, the default value used is a precision of 5 and a scale of zero (5,0).
Specifies a packed decimal number.
The optional precision of the number is the total number of digits. The precision can range from 1 to 31. If you specify precision, you have the option of also specifying scale. The optional scale of the number is the number of digits to the right of the decimal point. The scale can range from 0 to the precision.
If you specify both precision and scale, you must separate them with a comma and enclose them in parentheses. When specifying a scale of zero, however, you can use (precision) for (precision,0). If you do not specify precision and/or scale, the default value used is a precision of 5 and a scale of zero (5,0).
Specifies a large binary integer with a precision of 31 bits.
Specifies a small binary integer with a precision of 15 bits.
Specifies a 64-bit floating-point number.
Specifies a 64-bit floating-point number.
Specifies a date.
Specifies a time.
Specifies a timestamp.
GRAPHIC, VARGRAPHIC, and LONG VARGRAPHIC specify Double-Byte Character Set (DBCS) characters. Each character is two bytes long. The precision of a DBCS column (optional for GRAPHIC, required for VARGRAPHIC) is the maximum number of two-byte characters that can be stored, not the physical length.
DBCS characters in SQL statements must be delimited by the Shift-Out and Shift-In characters. Shift characters are either IBM-defined (X'0E' and X'0F') or Fujitsu-defined (X'28' and X'29'). Shift characters are specified in CXXMAINT OPTION=ALTER,DBCS=xx in the CA Datacom/DB Utility (DBUTLTY). If xx is IS or IM, the Shift characters are the IBM-defined characters. If xx is FS or FM, the Shift characters are the Fujitsu-defined characters. GRAPHIC, VARGRAPHIC, and LONG VARGRAPHIC.
|
Copyright © 2014 CA.
All rights reserved.
|
|