当前位置:网站首页>Chapter II data type (I)
Chapter II data type (I)
2022-06-10 18:55:00 【yaoxin521123】
List of articles
Chapter two data type ( One )
Appoint SQL Entity ( As listed ) Data types that can be included .
describe
The following topics are described here :
Supported by
DDLData type and its class attribute mapping tableData type priority is used to select the most inclusive data type from data values with different data types
date 、 Time 、PosixTime And timestamp data types
- Use SqlCategory And user-defined standards
- Yes 1840 year 12 month 31 Configurable support for dates before
Support string data types 、 List data type and stream data type
Support
ROWVERSIONdata typeIRIS Data platform ODBC / JDBC Exposed data types
Use the query metadata method and data type integer code to determine the data type of the column
Create user-defined data types
Handle undefined data types
Data type conversion function
The data type specifies the kind of values that the column can hold . In the use of CREATE TABLE or ALTER TABLE Specify the data type when defining the field . Definition SQL A field , The following table can be specified ( Left column ) Listed in the DDL data type . When specifying one of the DDL Data type , It maps to the... Listed in the right column IRIS Data type class . stay IRIS When defining fields in , You can specify DDL Data type or data type class . DDL Data type names are not case sensitive . Data type class names are case sensitive . %Library Data type classes can be defined by their full names ( for example ,%Library.String) Or short name (%String) To specify the .
They map to DDL Data types and data type classes usually provide different parameters and parameter defaults . Data type classes usually provide more information than DDL Data types have more parameters to define the allowed data values .
To view the current system data type mapping , Please go to the administration portal , Choose system management 、 To configure 、SQL And object settings 、 System DDL mapping .

You can also define other user data types . To create or view user data type mappings , Please go to the administration portal , Choose system management 、 To configure 、SQL And object settings 、 user DDL mapping .
DDL Data type table
| DDL Data Type | Corresponding IRIS Data Type Class |
|---|---|
BIGINT | %Library.BigInt (MAXVAL=9223372036854775807, MINVAL=-9223372036854775807) If BIGINT Columns can contain both NULL And minimal negative numbers , The index empty tag needs to be redefined to support the standard index collation . |
BIGINT(%1) | %Library.BigInt %1 Be ignored . amount to BIGINT. Provide MySQL Compatibility . |
BINARY | %Library.Binary(MAXLEN=1) |
BINARY(%1) | %Library.Binary(MAXLEN=%1) |
BINARY VARYING | %Library.Binary(MAXLEN=1) |
BINARY VARYING(%1) | %Library.Binary(MAXLEN=%1) |
BIT | %Library.Boolean . |
CHAR | %Library.String(MAXLEN=1) |
CHAR(%1) | %Library.String(MAXLEN=%1) |
CHAR VARYING | %Library.String(MAXLEN=1) |
CHAR VARYING(%1) | %Library.String(MAXLEN=%1) |
CHARACTER | %Library.String(MAXLEN=1) |
CHARACTER VARYING | %Library.String(MAXLEN=1) |
CHARACTER VARYING(%1) | %Library.String(MAXLEN=%1) |
CHARACTER(%1) | %Library.String(MAXLEN=%1) |
DATE | %Library.Date |
DATETIME | %Library.DateTime |
DATETIME2 | %Library.DateTime |
DEC | %Library.Numeric MAXVAL=999999999999999, MINVAL=-999999999999999, SCALE=0. |
DEC(%1) | %Library.Numeric One 64 Bit signed integer . If %1 Less than 19, be MAXVAL and MINVAL yes %1 digit . for example ,DEC(8) MAXVAL=99999999,MINVAL=-99999999,SCALE=0. %1 The most significant value of is 19; %1 Greater than 19 There will be no mistakes , But the default is 19. If %1 by 19 Or bigger :MAXVAL=9223372036854775807,MINVAL=-9223372036854775808,SCALE=0. |
| DEC(%1,%2) | %Library.Numeric (`MAXVAL=< |
| DECIMAL | %Library.Numeric MAXVAL=999999999999999, MINVAL=-999999999999999, SCALE=0. |
| DECIMAL(%1) | %Library.Numeric One 64 Bit signed integer . If %1 Less than 19, be MAXVAL and MINVAL yes %1 digit . for example ,DECIMAL(8) MAXVAL=99999999,MINVAL=-99999999,SCALE=0. %1 The most significant value of is 19; %1 Greater than 19 There will be no mistakes , But the default is 19. If %1 by 19 Or bigger :MAXVAL=9223372036854775807,MINVAL=-9223372036854775808,SCALE=0. |
| DECIMAL(%1,%2) | %Library.Numeric (`MAXVAL=< |
| DOUBLE | %Library.Double This is a IEEE Floating point standard . With this data type SQL The default precision returned by the column is 20. |
| DOUBLE PRECISION | %Library.Double This is a IEEE Floating point standard . With this data type SQL The default precision returned by the column is 20. |
| FLOAT | Have been abandoned — %Library.Double This is a IEEE Floating point standard . With this data type SQL The default precision returned by the column is 20. FLOAT(%1) Have been abandoned — %Library.Double This is a IEEE Floating point standard . With this data type SQL The default precision returned by the column is 20. |
| IMAGE | %Stream.GlobalBinary |
| INT | %Library.Integer (MAXVAL=2147483647, MINVAL=-2147483648) |
| INT(%1) | %Library.Integer (MAXVAL=2147483647, MINVAL=-2147483648). %1 Be ignored . amount to INT. Provide MySQL Compatibility . |
| INTEGER | %Library.Integer (MAXVAL=2147483647, MINVAL=-2147483648) |
| LONG | %Stream.GlobalCharacter |
| LONG BINARY | %Stream.GlobalBinary |
| LONG RAW | %Stream.GlobalBinary |
| LONGTEXT | %Stream.GlobalCharacter Equivalent to LONG. Provide MySQL Compatibility . |
| LONG VARCHAR | %Stream.GlobalCharacter |
| LONG VARCHAR(%1) | %Stream.GlobalCharacter The %1 is ignored. |
| LONGVARBINARY | %Stream.GlobalBinary |
| LONGVARBINARY(%1) | %Stream.GlobalBinary The %1 is ignored. |
| LONGVARCHAR | %Stream.GlobalCharacter |
| LONGVARCHAR(%1) | %Stream.GlobalCharacter The %1 is ignored. |
| MEDIUMINT | %Library.Integer(MAXVAL=8388607,MINVAL=-8388608) Provide MySQL Compatibility . |
| MEDIUMINT(%1) | %Library.Integer(MAXVAL=8388607,MINVAL=-8388608) %1 Be ignored . Provide MySQL Compatibility . |
| MEDIUMTEXT | %Stream.GlobalCharacter |
| MONEY | %Library.Currency(MAXVAL=922337203685477.5807, MINVAL=-922337203685477.5808, SCALE=4) |
| NATIONAL CHAR | %Library.String(MAXLEN=1) |
| NATIONAL CHAR(%1) | %Library.String(MAXLEN=%1) |
| NATIONAL CHAR VARYING | %Library.String(MAXLEN=1) |
| NATIONAL CHAR VARYING(%1) | %Library.String(MAXLEN=%1) |
| NATIONAL CHARACTER | %Library.String(MAXLEN=1) |
| NATIONAL CHARACTER(%1) | %Library.String(MAXLEN=%1) |
| NATIONAL CHARACTER VARYING | %Library.String(MAXLEN=1) |
| NATIONAL CHARACTER VARYING(%1) | %Library.String(MAXLEN=%1) |
| NATIONAL VARCHAR | %Library.String(MAXLEN=1) |
| NATIONAL VARCHAR(%1) | %Library.String(MAXLEN=%1) |
| NCHAR | %Library.String(MAXLEN=1) |
| NCHAR(%1) | %Library.String(MAXLEN=%1) |
| NTEXT | %Stream.GlobalCharacter |
| NUMBER | %Library.Numeric One 64 Bit signed integer . (MAXVAL=9223372036854775807, MINVAL=-9223372036854775808, SCALE=0) |
| NUMBER(%1) | %Library.Numeric One 64 Bit signed integer . If %1 Less than 19, be MAXVAL and MINVAL yes %1 digit . for example ,NUMBER(8) MAXVAL=99999999,MINVAL=-99999999,SCALE=0. %1 The most significant value of is 19; %1 Greater than 19 There will be no mistakes , But the default is 19. If %1 by 19 Or bigger :MAXVAL=9223372036854775807,MINVAL=-9223372036854775808,SCALE=0. |
| NUMBER(%1,%2) | %Library.Numeric (`MAXVAL=< |
| NUMERIC | %Library.Numeric MAXVAL=999999999999999, MINVAL=-999999999999999, SCALE=0. |
| NUMERIC(%1) | %Library.Numeric One 64 Bit signed integer . If %1 Less than 19, be MAXVAL and MINVAL yes %1 digit . for example ,NUMERIC(8) MAXVAL=99999999,MINVAL=-99999999,SCALE=0. %1 The most significant value of is 19; %1 Greater than 19 There will be no mistakes , But the default is 19. If %1 by 19 Or bigger :MAXVAL=9223372036854775807,MINVAL=-9223372036854775808,SCALE=0. |
| NUMERIC(%1,%2) | %Library.Numeric (`MAXVAL=< |
| NVARCHAR | %Library.String(MAXLEN=1) |
| NVARCHAR(%1) | %Library.String(MAXLEN=%1) |
| NVARCHAR(%1,%2) | %Library.String(MAXLEN=%1) |
| NVARCHAR(MAX) | %Stream.GlobalCharacter Equivalent to LONGVARCHAR. Provide TSQL Compatibility . |
| POSIXTIME | %Library.PosixTime MAXVAL=1406323805406846975, MINVAL=-6979664624441081856, SCALE=0. |
| RAW(%1) | %Library.Binary(MAXLEN=%1) REAL Have been abandoned — %Library.Double This is a IEEE Floating point standard . With this data type SQL The default precision returned by the column is 20. |
| ROWVERSION | %Library.RowVersion(MAXVAL=9223372036854775807, MINVAL=1) System allocated sequential integer . |
| SERIAL | %Library.Counter System-generated: (MAXVAL=9223372036854775807, MINVAL=1). User-supplied: (MAXVAL=9223372036854775807, MINVAL=-9223372036854775807) |
| SMALLDATETIME | %Library.DateTime MAXVAL=’2079-06-06 23:59:59’; MINVAL=’1900-01-01 00:00:00’) |
| SMALLINT | %Library.SmallInt (MAXVAL=32767, MINVAL=-32768) |
| SMALLINT(%1) | %Library.SmallInt %1 Be ignored . amount to SMALLINT. Provide MySQL Compatibility . |
| SMALLMONEY | %Library.Currency SCALE=4 |
| SYSNAME | %Library.String(MAXLEN=128) |
| TEXT | %Stream.GlobalCharacter |
| TIME | %Library.Time |
| TIME(%1) | %Library.Time( precision =%1). PRECISION Is the number of decimal seconds , A between 0 To 9 The integer value between . |
| TIMESTAMP | %Library.PosixTime |
| TIMESTAMP2 | %Library.TimeStamp |
| TINYINT | %Library.TinyInt (MAXVAL=127, MINVAL=-128) |
| TINYINT(%1) | %Library.TinyInt %1 Be ignored . amount to TINYINT. Provide MySQL Compatibility . |
| UNIQUEIDENTIFIER) | %Library.UniqueIdentifier |
| VARBINARY) | %Library.Binary(MAXLEN=1) |
| VARBINARY(%1)) | %Library.Binary(MAXLEN=%1) |
| VARCHAR ) | %Library.String(MAXLEN=1) |
| VARCHAR(%1) ) | %Library.String(MAXLEN=%1) |
| VARCHAR(%1,%2)) | %Library.String(MAXLEN=%1) |
| VARCHAR2(%1)) | %Library.String(MAXLEN=%1) |
| VARCHAR(MAX)) | %Stream.GlobalCharacter Equivalent to LONGVARCHAR. Available only TSQL Compatibility . |
Important note : Each... Shown above DDL or IRIS Data type expressions are actually a continuous string . These strings may contain space characters , But it usually doesn't contain any kind of space . For easy reading , There are some blanks in this table .
Appoint MAXLEN
- nothing
MAXLEN: No,MAXLENThe value field can take values of any length , Maximum string length . To define the maximum length string field , Please specifyVARCHAR(''), This will create a data type of%Library.String(MAXLEN="")Properties of .VARCHAR()The created data type is%Library.String(MAXLEN=1)Properties of . To define noMAXLENBinary field of value , Please specifyVARBINARY(''), This will create a data type of%Library.Binary(MAXLEN="")Properties of .VARBINARY()The created data type is%Library.Binary(MAXLEN=1)Properties of . - Big
MAXLEN: Have a bigMAXLENThe value field only allocates the space required for the actual data value . Appoint%Library.StringData type , designatedMAXLENThe value does not have to correspond closely to the actual size of the data . If the field value is“ABC”, Use only disks 、 So much space in the global buffer and private process memory . Even usingMAXLEN=1000Declare this field , Private process memory will not allocate so much space for this field . Allocate memory only for the actual size of the field value , Regardless of the length of the declaration .
Too much MAXLEN Values may affect ODBC Applications . ODBC The application tries to determine the size of the required fields based on the metadata from the server , Therefore, the application may allocate more buffer space than it actually needs . For this reason , Provides system wide defaults ODBC VARCHAR Maximum length 4096; The system wide default settings can be configured using the management portal : Select configuration from system management , And then choose SQL And object settings , And then choose SQL. View or set up VARCHAR The default length of the option . To determine the current settings , Please call $SYSTEM.SQL.CurrentSettings(). ODBC Driver from TCP The buffer takes the data and converts it into an application buffer , therefore MAXLEN Size doesn't affect our ODBC client .
Too much MAXLEN The value should not affect JDBC Applications . Java and .Net No application allocated buffer . The client allocates only what is required to save the data as a native type .
Accuracy and range
NUMERIC(6,2) Equal value data types have two integer values (p,s) Precision and scale . These are mapped to ObjectScript %Library Class data type . stay SQL When specified in the data type , The following applies to Windows System ( The maximum value may be different on other systems ):
Precisionprecision :0To19+s( contain ) Integer between . This value determines the maximum and minimum allowable values . This is usually the total number of digits in a number ; however , Its exact value is determined by%LibraryClass data type mapping determines . The maximum integer value is9223372036854775807. Greater than19+sThe default precision of is19+s.- Scale: An integer , Specify the maximum decimal allowed ( decimal ) digit . It can be a positive integer 、0 Or negative integer . If s Greater than or equal to
p, Only decimals are allowed , actualpValue ignored . The maximum proportion allowed is 18, Corresponding to0.999999999999999999. Greater than18The default scale is 18.
The following example shows the maximum values for different combinations of precision and scale :
ClassMethod PrecisionScale()
{
for i = 0 : 1 : 6 {
w "Max for (",i,",2)=",$$maxval^%apiSQL(i,2),!
}
}
DHC-APP>d ##class(PHA.TEST.SQLFunction).PrecisionScale()
Max for (0,2)=.99
Max for (1,2)=.99
Max for (2,2)=.99
Max for (3,2)=9.99
Max for (4,2)=99.99
Max for (5,2)=999.99
Max for (6,2)=9999.99
边栏推荐
- Form form of the uniapp uview framework, input the verification mobile number and verification micro signal
- Stream生成的3张方式-Lambda
- 不确定性推理:让模型知道自己不知道
- 【QNX Hypervisor 2.2 用户手册】3.2.1 VM配置语法
- 第四章 数据类型(三)
- VMware horizon 82111 deployment series (XVI) blast bandwidth test
- Ruijie x32pro brush openwrt enable wireless 160MHz
- Cross domain error: when allowcredentials is true, allowedorigins cannot contain the special value "*“
- 锐捷x32pro刷openwrt开启无线160MHz
- 5. golang generics and reflection
猜你喜欢

Metadata management, the basic construction of enterprises in the digital era

Custom types: structural bodies

Opencv does not rely on any third-party database for face detection

vcsa7u3c安装教程

Request header field xxxx is not allowed by Access-Control-Allow-Headers in preflight response问题

Ruijie x32pro brush openwrt enable wireless 160MHz

Adobe Premiere foundation - tool use (selection tool, razor tool, and other common tools) (III)

商业智能BI的服务对象,企业管理者的管理“欲望”该如何实现?

Introduction to ad18 device library import

Uniapp native JS to convert the Gregorian calendar to the lunar calendar
随机推荐
uniapp 原生js实现公历转农历
【QNX Hypervisor 2.2 用户手册】3.2.1 VM配置语法
Adobe Premiere foundation - opacity (matte) (11)
Adobe Premiere foundation - Import and export, merge materials, source file compilation, offline (II)
Building smart community Internet of things based on smart road lamp posts
Request header field XXXX is not allowed by access control allow headers in preflight response
企业数据质量管理:如何进行数据质量评估?
Three ways generated by stream lambda
[kuangbin]专题十二 基础DP1
AGI基础,不确定性推理,主观逻辑一书ppt2
阵列信号处理仿真之四——Z变换分析阵列多项式
Use of uiautomator2 automated test tool
3. getting started with golang concurrency
5. Golang泛型与反射
第三章 数据类型(二)
[kuangbin] topic 12 basic DP1
Custom types: structural bodies
企业管理者的质疑,这么多年的信息化,我们的钱花哪去了?
商业智能BI的服务对象,企业管理者的管理“欲望”该如何实现?
商业智能BI在企业的价值之:业务分析发展决策