To manually specify the SQL data type, each command line attribute argument can take the form attribute=datatype. No spaces are permitted around the = character.
These types are supported on the SQL-CREATE-VIEW command line:
DATE
DECIMAL(p, s)
DOUBLE PRECISION
FLOAT(p)
INTEGER
NUMERIC(p, s)
REAL
SINGLE
SMALLINT
TIME
TIMESTAMP
VARCHAR(length)
where p and s stand for precision and scale.
Below is an example of manually specifying data types on the command line. The example continues from the CUST file example used above in Customizing the SQL macro.
SQL-CREATE-VIEW CUST NAME=varchar(20) AGE=integer (c
Length, precision and scale are optional. If omitted, the default value is used. Some numeric types specified on the command line, namely, DECIMAL, FLOAT, REAL, and DOUBLE PRECISION, are stored as NUMERIC in the D3 SQL catalog.
The chart below summarizes the conversion and default values.
Command Line Specified Data Type | Stored D3 Data Type | Default Precision or Column Length | Default Scale |
---|---|---|---|
DATE | DATE | 10 | |
DECIMAL | NUMERIC | 10 | 0 |
DOUBLE PRECISION | NUMERIC | 15 | 4 |
FLOAT | NUMERIC | 15 | 4 |
INTEGER | INTEGER | 10 | 0 |
NUMERIC | NUMERIC | 10 | 0 |
REAL | NUMERIC | 15 | 4 |
SINGLE | NUMERIC | 15 | 4 |
SMALLINT | SMALLINT | 5 | 0 |
TIME | TIME | 8 | |
TIMESTAMP | TIMESTAMP | 19 | |
VARCHAR | VARCHAR | 10 |