oracle数据类型
来源:互联网 发布:下载行者软件 编辑:程序博客网 时间:2024/06/05 23:41
Oracle/PLSQL: Data Types
The following is a list of datatypes available in Oracle.
//z 2012-08-01 13:48:57 is2120@csdn.T1290880757[T6,L73,R2,V39]
Character Datatypes
Syntax
(if applicable)
Numeric Datatypes
Syntax
(if applicable)
Scale can range from -84 to 127.Precision can range from 1 to 38.
Scale can range from -84 to 127.Precision can range from 1 to 38.
Scale can range from -84 to 127.Where p is the precision and s is the scale.
For example, number(7,2) is a number that has 5 digits before the decimal and 2 digits after the decimal.
numeric(p,s)Precision can range from 1 to 38.Precision can range from 1 to 38.Precision can range from 1 to 38.Where p is the precision and s is the scale.For example, numeric(7,2) is a number that has 5 digits before the decimal and 2 digits after the decimal.
float dec(p,s)Precision can range from 1 to 38.Precision can range from 1 to 38.Precision can range from 1 to 38.Where p is the precision and s is the scale.For example, dec(3,1) is a number that has 2 digits before the decimal and 1 digit after the decimal.
decimal(p,s)Precision can range from 1 to 38.Precision can range from 1 to 38.Precision can range from 1 to 38.Where p is the precision and s is the scale.For example, decimal(3,1) is a number that has 2 digits before the decimal and 1 digit after the decimal.
integer int smallint real double precision
Date/Time Datatypes
Syntax
(if applicable)
timestamp (fractional seconds precision)fractional seconds precisionmust be a number between 0 and 9. (default is 6)fractional seconds precisionmust be a number between 0 and 9. (default is 6)fractional seconds precisionmust be a number between 0 and 9. (default is 6)
Includes year, month, day, hour, minute, and seconds.
For example:
timestamp(6)
Includes year, month, day, hour, minute, and seconds; with a time zone displacement value.
For example:
timestamp(5) with time zone
For example:
timestamp(4) with local time zone
(year precision)
to monthyear precision is the number of digits in the year. (default is 2)year precision is the number of digits in the year. (default is 2)year precision is the number of digits in the year. (default is 2)Time period stored in years and months.
For example:
interval year(4) to month
(day precision)
to second (fractional seconds precision)day precisionmust be a number between 0 and 9. (default is 2)
fractional seconds precisionmust be a number between 0 and 9. (default is 6)
day precisionmust be a number between 0 and 9. (default is 2)fractional seconds precisionmust be a number between 0 and 9. (default is 6)
day precisionmust be a number between 0 and 9. (default is 2)fractional seconds precisionmust be a number between 0 and 9. (default is 6)
Time period stored in days, hours, minutes, and seconds.For example:
interval day(2) to second(6)
Large Object (LOB) Datatypes
Syntax
(if applicable)
Rowid Datatypes
Syntax
(if applicable)
Where BBBBBBB is the block in the database file;
RRRR is the row in the block;
FFFFF is the database file.
Where BBBBBBB is the block in the database file;
RRRR is the row in the block;
FFFFF is the database file.
Where BBBBBBB is the block in the database file;
RRRR is the row in the block;
FFFFF is the database file.
Where size is optional.
//z 2012-08-01 13:48:57 is2120@csdn.T1290880757[T6,L73,R2,V39]1 Data Types
A data type defines a set of values. A reference to a data type specifies the set of values that can occur in a given context. A data type is associated with each value retrieved from a table or computed in an expression and each constant.
TimesTen follows the ODBC standard for type conversion. For more information, refer to ODBC API reference documentation, which is available from Microsoft or a variety of third parties. The following site contains Microsoft's ODBC API reference documentation:
http://msdn.microsoft.com/en-us/library/ms714562(VS.85).aspx
If you are using IMDB Cache, see "Mappings between Oracle and TimesTen data types" in Oracle In-Memory Database Cache User's Guide. This section compares valid data types for creating cache group columns, as well as type conversions for passthrough queries.
The following subjects describe data types in TimesTen:
Type specifications
ANSI SQL data types
Types supported for backward compatibility in Oracle type mode
TimesTen type mapping
Character data types
Numeric data types
BINARY and VARBINARY data types
Numeric precedence
LOB data types
ROWID data type
Datetime data types
TimesTen intervals
Storage requirements
Data type comparison rules
Data type conversion
Null values
INF and NAN
Overflow and truncation
Underflow
Replication limits
TimesTen type mode (backward compatibility)
Type specifications
TimesTen supports the data types in Table 1-1 in the default Oracle type mode. Type mode is a data store attribute, where TypeMode=0
indicates Oracle type mode and TypeMode=1
indicates TimesTen mode. For more information on data type modes, see "TimesTen type mode (backward compatibility)" and "TypeMode" inOracle TimesTen In-Memory Database Reference.
Table 1-1 Data types supported in Oracle type mode
BINARY
(
n
)
Fixed-length binary value of n
bytes. Legal values forn
range from 1 to 8300. BINARY
data is padded to the maximum column size with trailing zeroes. Alternatively, specifyTT_BINARY
(
n
)
.
For more details, see "BINARY and VARBINARY data types".
BINARY_DOUBLE
A 64-bit floating-point number. BINARY_DOUBLE
is a double-precision native floating point number that supports+Inf
, -Inf
, and NaN
values. BINARY_DOUBLE
is an approximate numeric value consisting of an exponent and mantissa. You can use exponential or E-notation.BINARY_DOUBLE
has binary precision 53.
Minimum positive finite value: 2.22507485850720E-308
Maximum positive finite value: 1.79769313486231E+308
For more details, see "BINARY_DOUBLE".
BINARY_FLOAT
A 32-bit floating-point number. BINARY_FLOAT
is a single-precision native floating-point type that supports+Inf
, -Inf
, and NaN
values.BINARY_FLOAT
is an approximate numeric value consisting of an exponent and mantissa. You can use exponential or E-notation.BINARY_FLOAT
has binary precision 24.
Minimum positive finite value: 1.17549E-38F
Maximum positive finite value: 3.40282E+38F
For more details, see "BINARY_FLOAT".
BLOB
A binary large object. Variable-length binary value with a maximum size of 16 MB.
For more details, see "BLOB".
CHAR
[ACTER][(
n
[BYTE|CHAR])]
Fixed-length character string of length n
bytes or characters. Default is one byte.
BYTE
indicates that the column has byte-length semantics. Legal values forn
range from a minimum of one byte to a maximum of 8300 bytes.
CHAR
indicates that the column has character-length semantics. The minimumCHAR
length is one character. The maximum CHAR
length depends on how many characters fit in 8300 bytes. This is determined by the database character set in use. For character setAL32UTF8
, up to four bytes per character may be needed, so the CHAR
length limit ranges from 2075 to 8300 depending on the character set.
A zero-length string is interpreted as NULL
.
CHAR
data is padded to the maximum column size with trailing blanks. Blank-padded comparison semantics are used.
Alternatively, specify ORA_CHAR[(
n
[BYTE|CHAR])]
.
For more details, see "CHAR".
CLOB
A character large object containing single-byte or multibyte characters. Variable-length large object with a maximum size of 4 MB.
For more details, see "CLOB".
DATE
Stores date and time information: century, year, month, day, hour, minute, and second. Format is:
YYYY-MM-DD HHMMSS
.
Valid date range is from January 1, 4712 BC to December 31, 9999 AD.
There are no fractional seconds.
Alternatively, specify ORA_
DATE
.
For more details, see "DATE".
INTERVAL [+/-]
IntervalQualifier
TimesTen partially supports interval types, expressed with the type INTERVAL
and anIntervalQualifier
. An IntervalQualifier
can only specify a single field type with no precision. The default leading precision is eight digits for all interval types. The single field type can be: year, month, day, hour, minute, or second. Currently, interval types can be specified only with a constant.
Note: You cannot specify a column of an interval type. These are non-persistent types used in SQL expressions at runtime. In addition, for those comparisons where an interval data type is returned, the interval data type cannot be the final result of a complete expression. The EXTRACT
function must be used to extract the desired component of this interval result.
For more details, see "TimesTen intervals".
NCHAR
[(
n
)
]
Fixed-length string of n
two-byte Unicode characters.
The number of bytes required is 2*n
wheren
is the specified number of characters.NCHAR
character limits are half the byte limits so the maximum size is 4150.
A zero-length string is interpreted as NULL
.
NCHAR
data is padded to the maximum column size with U+0020 SPACE
. Blank-padded comparison semantics are used.
Alternatively, specify ORA_NCHAR[(
n
)]
.
For more details, see "NCHAR".
NCLOB
A national character large object containing Unicode characters. Variable-length character value with a maximum size of 4 MB.
For more details, see "NCLOB".
NUMBER[(
p
[,
s
])]
Number having precision and scale. The precision ranges from 1 to 38 decimal. The scale ranges from -84 to 127. Both precision and scale are optional.
If you do not specify a precision or a scale, TimesTen assumes the maximum precision of 38 and flexible scale.
NUMBER
supports negative scale and scale greater than precision.
NUMBER
stores zero as well as positive and negative fixed numbers with absolute values from 1.0 x 10-130 to (but not including) 1.0 x 10126. If you specify an arithmetic expression whose value has an absolute value greater than or equal to 1.0 x 10126, then TimesTen returns an error.
For more details, see "NUMBER".
NVARCHAR2(
n
)
Variable-length string of n
two-byte Unicode characters.
The number of bytes required is 2*n
wheren
is the specified number of characters.NVARCHAR2
character limits are half the byte limits so the maximum size is 2,097,152 (221). You must specifyn
.
A zero-length string is interpreted as NULL
.
Nonpadded comparison semantics are used.
Alternatively, specify ORA_NVARCHAR2(
n
)
.
For more details, see "NVARCHAR2".
ROWID
An 18-byte character string that represents the address of a table row or materialized view row.
Specify a literal ROWID
value as a CHAR
constant enclosed in single quotes.
For more details, see "ROWID data type".
TIME
A time of day between 00:00:00 (midnight) and 23:59:59 (11:59:59 pm), inclusive. The format is:HH:MI:SS
.
Alternatively, specify TT_TIME
.
For more details, see "TIME".
TIMESTAMP
[(
fractional_seconds_precision
)]
Stores year, month, and day values of the date plus hour, minute, and second values of the time. Thefractional_seconds_precision
is the number of digits in the fractional part of the seconds field. Valid date range is from January 1, 4712 BC to December 31, 9999 AD.
TT_TIMESTAMP
has a smaller storage size thanTIMESTAMP
.TT_TIMESTAMP
is faster than TIMESTAMP
becauseTT_TIMESTAMP
is an eight-byte integer containing the number of microseconds since January 1, 1754. Comparisons are very fast.TIMESTAMP
has a larger range than TT_TIMESTAMP
in thatTIMESTAMP
can store date and time data as far back as 4712 BC.TIMESTAMP
also supports up to nine digits of fractional second precision whereasTT_TIMESTAMP
supports six digits of fractional second precision.
The fractional seconds precision range is 0 to 9. The default is 6. Format is:
YYYY-MM-DD HH:MI:SS [.FFFFFFFFF]
Alternatively, specifyORA_TIMESTAMP[(
fractional_seconds_precision
)]
For more details, see "TIMESTAMP".
TT_BIGINT
A signed eight-byte integer in the following range:
-9,223,372,036,854,775,808 (-263) to
9,223,372,036,854,775,807 (263-1).
Use TT_BIGINT
rather than the NUMBER
data type. TT_BIGINT
is more compact and offers faster performance than the NUMBER
type. If you need to store greater than 19-digit integers, useNUMBER
(
p
)
wherep
> 19.
For more details, see "TT_BIGINT".
TT_DATE
Stores date information: century, year, month, and day. The format is YYYY-MM-DD
, whereMM
is expressed as an integer such as 2006-10-28.
Valid dates are between 1753-01-01 (January 1, 1753) and 9999-12-31 (December 31, 9999).
For more details, see "TT_DATE".
TT_INTEGER
A signed integer in the range -2,147,483,648 (-231) to 2,147,483,647 (231-1).
TT_INTEGER
is a native signed integer data type. Use TT_INTEGER
rather thanINTEGER
. INTEGER
maps to the NUMBER
data type.TT_INTEGER
is more compact and offers faster performance than the NUMBER
type. If you need to store greater than 19-digit integers, use NUMBER
(
p
)
wherep
> 19.
For more details, see "TT_INTEGER".
TT_SMALLINT
A native signed 16-bit integer in the range -32,768 (-215) to 32,767 (215-1).
Use TT_SMALLINT
rather than SMALLINT
. SMALLINT
maps to theNUMBER
data type.
TT_SMALLINT
is more compact and offers faster performance than theNUMBER
type. If you need to store greater than 19-digit integers, useNUMBER
(
p
)
wherep
> 19.
For more details, see "TT_SMALLINT".
TT_TIMESTAMP
A date and time between 1753-01-01 00:00:00 (midnight on January 1, 1753) and 9999-12-31 23:59:59 pm (11:59:59 pm on December 31, 9999), inclusive. Any values for the fraction not specified in full microseconds result in a "Data Truncated
" error. The format is YYYY-MM-DD HH:MI:SS [.FFFFFFFFF]
.
TT_TIMESTAMP
has a smaller storage size than TIMESTAMP
and is faster thanTIMESTAMP
because TT_TIMESTAMP
is an eight-byte integer containing the number of microseconds since January 1, 1754. Comparisons are very fast.TIMESTAMP
has a larger range than TT_TIMESTAMP
in that TIMESTAMP
can store date and time data as far back as 4712 BC. TIMESTAMP
also supports up to nine digits of fractional second precision whereasTT_TIMESTAMP
supports six digits of fractional second precision.
You can specify TT_TIMESTAMP(6)
.
For more details, see "TT_TIMESTAMP".
TT_TINYINT
Unsigned integer ranging from 0 to 255 (28-1).
Use TT_TINYINT
rather than the NUMBER
data type. TT_TINYINT
is more compact and offers faster performance than the NUMBER
type. If you need to store greater than 19-digit integers, useNUMBER(
p
)
wherep
> 19.
Since TT_TINYINT
is unsigned, the negation of a TT_TINYINT
is aTT_SMALLINT
.
For more details, see "TT_TINYINT".
VARBINARY
(
n
)
Variable-length binary value having maximum length n
bytes. Legal values forn
range from 1 to 4194304 (222).
Alternatively, specify TT_VARBINARY(
n
)
.
For more details, see "BINARY and VARBINARY data types".
VARCHAR[2](
n
[BYTE|CHAR])
Variable-length character string having maximum length n
bytes or characters.
BYTE
indicates that the column has byte-length semantics. Legal values forn
range from a minimum of one byte to a maximum 4194304 (222) bytes. You must specifyn
.
CHAR
indicates that the column has character-length semantics.
A zero-length string is interpreted as NULL
.
Nonpadded comparison semantics are used.
Do not use the VARCHAR
type. Although it is currently synonymous withVARCHAR2
, the VARCHAR
type is scheduled to be redefined.
Alternatively, specify ORA_VARCHAR2(
n
[BYTE|CHAR])
.
For more details, see "VARCHAR2".
ANSI SQL data types
TimesTen supports ANSI SQL data types in Oracle type mode. These data types are converted to TimesTen data types with data stored as TimesTen data types.Table 1-2 shows how the ANSI SQL data types are mapped to TimesTen data types.
Table 1-2 Data type mapping: ANSI SQL to TImesTen
CHARACTER VARYING(
n
[BYTE|CHAR])
or
CHAR VARYING(
n
[BYTE|CHAR])
VARCHAR2(
n
[BYTE|CHAR])
Character semantics is supported.
DOUBLE [PRECISION]
NUMBER
Floating-point number with a binary precision of 126.
Alternatively, specify FLOAT(126)
or ORA_FLOAT(126)
.
FLOAT[(
b
)]
NUMBER
Floating-point number with binary precision b
. Acceptable values forb
are between 1 and 126 (binary digits).
FLOAT
is an exact numeric type. Use FLOAT
to define a column with a floated scale and a specified precision. A floated scale is supported with theNUMBER
type, but you cannot specify the precision. A lower precision requires less space, so because you can specify a precision withFLOAT
, it may be more desirable thanNUMBER
. If you do not specifyb
, then the default precision is 126 binary (38 decimal).
BINARY_FLOAT
and BINARY_DOUBLE
are inexact numeric types and are therefore different floating types thanFLOAT
. In addition, the semantics are different between FLOAT
andBINARY_FLOAT
/BINARY_DOUBLE
because BINARY_FLOAT
andBINARY_DOUBLE
conform to the IEEE standard.
Internally, FLOAT
is implemented as type NUMBER
.
Alternatively, specify ORA_FLOAT
. For example:
FLOAT(24) = ORA_FLOAT(24)
FLOAT(53) = ORA_FLOAT(53
)
FLOAT(
n
) = ORA_FLOAT(
n
)
INT[EGER]
NUMBER
(38,0)
TT_INTEGER
is a native 32-bit integer type. UseTT_INTEGER
, as this data type is more compact and offers faster performance than theNUMBER
type.
NATIONAL CHARACTER(
n
)
or
NATIONAL
CHAR
(
n
)
NCHAR(
n
)
NATIONAL CHARACTER VARYING(
n
)
or
NATIONAL CHAR VARYING(
n
)
or
NCHAR VARYING(
n
)
NVARCHAR2(
n
)
NUMERIC
[(
p
[,
s
])]
or
DEC[IMAL][(
p
[,
s
])]
NUMBER(
p,s
)
Specifies a fixed-point number with precision p
and scales.
This can only be used for fixed-point numbers. If no scale is specified,s
defaults to 0.
REAL
NUMBER
Floating-point number with a binary precision of 63.
Alternatively, specify ORA_FLOAT(63)
or FLOAT(63)
.
SMALLINT
NUMBER(38,0)
TT_SMALLINT
is a native signed integer data type. UsingTT_SMALLINT
is more compact and offers faster performance than theNUMBER
type.
Types supported for backward compatibility in Oracle type mode
TimesTen supports the data types shown in Table 1-3 for backward compatibility in Oracle type mode.
Table 1-3 Data types supported for backward compatibility in Oracle type mode
TT_CHAR[(
n
[BYTE|CHAR])]
Fixed-length character string of length n
bytes or characters. Default is one byte.
BYTE
indicates that the column has byte-length semantics. Legal values forn
range from a minimum of one byte to a maximum 8300 bytes.
CHAR
indicates that the column has character-length semantics. The minimumCHAR
length is one character. The maximum CHAR
length depends on how many characters fit in 8300 bytes. This is determined by the database character set in use. For character setAL32UTF8
, up to four bytes per character may be needed, so the CHAR
length limit ranges from 2075 to 8300 depending on the character set.
If you insert a zero-length (empty) string into a column, the SQL NULL
value is inserted. This is true in Oracle type mode only.
TT_CHAR
data is padded to the maximum column size with trailing blanks. Blank-padded comparison semantics are used.
TT_DECIMAL[(
p
[,
s
])]
An exact numeric value with a fixed maximum precision (total number of digits) and scale (number of digits to the right of the decimal point). The precisionp
must be between 1 and 40. The scales
must be between 0 and p
. The default precision is 40 and the default scale is 0.
Use the NUMBER
data type, which offers better performance, rather thanTT_DECIMAL
.
TT_NCHAR[(
n
)]
Fixed-length string of n
two-byte Unicode characters.
The number of bytes required is 2*n
wheren
is the specified number of characters.NCHAR
character limits are half the byte limits so the maximum size is 4150.
If you insert a zero-length (empty) string into a column, the SQL NULL
value is inserted. This is true in Oracle type mode only.
TT_NCHAR
data is padded to the maximum column size with U+0020 SPACE
. Blank-padded comparison semantics are used.
TT_NVARCHAR(
n
)
Variable-length string of n
two-byte Unicode characters.
The number of bytes required is 2*n
where n is the specified number of characters.TT_NVARCHAR
character limits are half the byte limits so the maximum size is 2,097,152 (221). You must specifyn
.
If you insert a zero-length (empty) string into a column, the SQL NULL
value is inserted. This is true in Oracle type mode only.
Blank-padded comparison semantics are used.
TT_VARCHAR(
n
[BYTE|CHAR])
Variable-length character string having maximum length n
bytes or characters. You must specifyn
.
BYTE
indicates that the column has byte-length semantics. Legal values forn
range from a minimum of 1 byte to a maximum 4194304 (222) bytes.
CHAR
indicates that the column has character-length semantics.
If you insert a zero-length (empty) string into a column, the SQL NULL
value is inserted. This is true in Oracle type mode only.
Blank-padded comparison semantics are used.
BIGINT
TT_BIGINT
In Oracle type mode, specify TT_BIGINT
. For more information onTT_BIGINT
, see "Type specifications".
BINARY(
n
)
BINARY(
n
)
In Oracle type mode, the data type has the same name. For more information on BINARY(
n
)
, see"Type specifications".
CHAR[ACTER][(
n
)]
TT_CHAR[(
n
[BYTE|CHAR])]
In Oracle type mode, specify TT_CHAR
. Character semantics is supported. For more information on typeTT_CHAR
, see "Types supported for backward compatibility in Oracle type mode".
DATE
TT_DATE
In Oracle type mode, specify TT_DATE
. For more information on TT_DATE
, see "Type specifications".
DEC[IMAL][(
p
[,
s
])]
or
NUMERIC[(
p
[,
s
])]
TT_DECIMAL[(
p
[,
s
])]
In Oracle type mode, specify TT_DECIMAL
.
For more information on TT_DECIMAL
, see "Types supported for backward compatibility in Oracle type mode".
DOUBLE [PRECISION]
or
FLOAT[(53)]
BINARY_DOUBLE
In Oracle type mode, specify BINARY_DOUBLE
. For more information onBINARY_DOUBLE
, see "Type specifications".
INT[EGER]
TT_INT[EGER]
In Oracle type mode, specify TT_INTEGER
. For more information onTT_INTEGER
, see "Type specifications".
INTERVAL
IntervalQualifier
INTERVAL
IntervalQualifier
In Oracle type mode, the data type has the same name. For more information on interval types, see"Type specifications".
NCHAR[(
n
)]
TT_NCHAR[(
n
)]
In Oracle type mode, specify TT_CHAR
. For more information on TT_NCHAR
, see "Types supported for backward compatibility in Oracle type mode".
NVARCHAR(
n
)
TT_NVARCHAR(
n
)
In Oracle type mode, specify TT_NVARCHAR
. For more information onTT_NVARCHAR
, see "Types supported for backward compatibility in Oracle type mode".
REAL
or
FLOAT(24)
BINARY_FLOAT
In Oracle type mode, specify BINARY_FLOAT
. For more information onBINARY_FLOAT
, see "Type specifications".
SMALLINT
TT_SMALLINT
In Oracle type mode, specify TT_SMALLINT
. For more information onTT_SMALLINT
, see "Type specifications".
TIME
TIME
In Oracle type mode, the data type has the same name. For more information on TIME
, see "Type specifications".
TIMESTAMP
TT_TIMESTAMP
In Oracle type mode, specify TT_TIMESTAMP
. For more information onTT_TIMESTAMP
, see "Type specifications".
TINYINT
TT_TINYINT
In Oracle type mode, specify TT_TINYINT
. For more information onTT_TINYINT
, see "Type specifications".
VARBINARY(
n
)
VARBINARY(
n
)
In Oracle type mode, the data type has the same name. For more information on VARBINARY(
n
)
, see"Type specifications".
VARCHAR(
n
)
TT_VARCHAR(
n
[BYTE|CHAR])
In Oracle type mode, specify TT_VARCHAR
. Character semantics is supported. For more information onTT_VARCHAR
, see "Types supported for backward compatibility in Oracle type mode".
Character data types
Character data types store character (alphanumeric) data either in the database character set or the UTF-16 format. Character data is stored in strings with byte values. The byte values correspond to one of the database character sets defined when the database is created. TimesTen supports both single and multibyte character sets.
The character types are as follows:
CHAR
NCHAR
VARCHAR2
NVARCHAR2
CHAR
The CHAR
type specifies a fixed length character string. If you insert a value into aCHAR
column and the value is shorter than the defined column length, then TimesTen blank-pads the value to the column length. If you insert a value into aCHAR
column and the value is longer than the defined length, TimesTen returns an error.
By default, the column length is defined in bytes. Use the CHAR
qualifier to define the column length in characters. The size of a character ranges from one byte to four bytes depending on the database character set. TheBYTE
and CHAR
qualifiers override the NLS_LENGTH_SEMANTICS
parameter setting. For more information aboutNLS_LENGTH_SEMANTICS
, see "ALTER SESSION" and "Setting globalization support attributes" in Oracle TimesTen In-Memory Database Operations Guide.
Note:
With theCHAR
type, a zero-length string is interpreted as NULL
. With theTT_CHAR
type, a zero-length string is a valid non-NULL
value. BothCHAR
and TT_CHAR
use blank padded comparison semantics. TheTT_CHAR
type is supported for backward compatibility.The following example creates a table. Columns are defined with type CHAR
andTT_CHAR
. Blank padded comparison semantics are used for these types.
Command> CREATE TABLE typedemo (name CHAR (20), nnme2 TT_CHAR (20));Command> INSERT INTO typedemo VALUES ('SMITH ','SMITH ');1 row inserted.Command> DESCRIBE typedemo;Table USER.TYPEDEMO: Columns: NAME CHAR (20) NAME2 TT_CHAR (20)1 table found.(primary key columns are indicated with *)Command> SELECT * FROM typedemo;< SMITH , SMITH >1 row found.Command> # Expect 1 row found; blank-padded comparison semanticsCommand> SELECT * FROM typedemo WHERE name = 'SMITH';< SMITH , SMITH >1 row found.Command> SELECT * FROM typedemo WHERE name2 = 'SMITH';< SMITH , SMITH >1 row found.Command> # Expect 0 rows; blank padded comparison semantics.Command> SELECT * FROM typedemo WHERE name > 'SMITH';0 rows found.Command> SELECT * FROM typedemo WHERE name2 > 'SMITH';0 rows found.
The following example alters table typedemo
adding column name3
. The columnname3
is defined with character semantics.
Command> ALTER TABLE typedemo ADD COLUMN name3 CHAR (10 CHAR);Command> DESCRIBE typedemo;Table USER.TYPEDEMO: Columns: NAME CHAR (20) NAME2 TT_CHAR (20) NAME3 CHAR (10 CHAR)1 table found.
NCHAR
The NCHAR
data type is a fixed length string of two-byte Unicode characters.NCHAR
data types are padded to the specified length with the Unicode space characterU+0020 SPACE
. Blank-padded comparison semantics are used.
Note:
With theNCHAR
type, a zero-length string is interpreted as NULL
. With theTT_NCHAR
type, a zero-length string is a valid non-NULL
value. BothNCHAR
and TT_NCHAR
use blank padded comparison semantics. TheTT_NCHAR
type is supported for backward compatibility.The following example alters table typedemo
, adding column Name4
. Data type is NCHAR
.
Command> ALTER TABLE typedemo ADD COLUMN Name4 NCHAR (10);Command> DESCRIBE typedemo;Table USER.TYPEDEMO: Columns: NAME CHAR (20) NAME2 TT_CHAR (20) NAME3 CHAR (10 CHAR) NAME4 NCHAR (10)1 table found.
VARCHAR2
The VARCHAR2
data type specifies a variable length character string. When you define aVARCHAR2
column, you define the maximum number of bytes or characters. Each value is stored exactly as you specify it. The value cannot exceed the maximum length of the column.
You must specify the maximum length. The minimum must be at least one byte. Use theCHAR
qualifier to specify the maximum length in characters. For example,VARCHAR2(10 CHAR)
.
The size of a character ranges from one byte to four bytes depending on the database character set. TheBYTE
and CHAR
qualifiers override the NLS_LENGTH_SEMANTICS
parameter setting. For more information onNLS_LENGTH_SEMANTICS
, see "ALTER SESSION" and "Setting globalization support attributes" in Oracle TimesTen In-Memory Database Operations Guide.
The NULL
value is stored as a single bit for each nullable field within the row. ANOT INLINE VARCHAR2(
n
)
whose value isNULL
takes (null bit) + four bytes of storage on 32-bit platforms, whereas anINLINE VARCHAR2(
n
)
whose value isNULL
takes (null bit) + four bytes + n
bytes of storage, orn
more bytes of storage than aNOT INLINE VARCHAR2(
n
)
whose value isNULL
. This storage principal holds for all variable length data types:TT_VARCHAR
,TT_NVARCHAR
, VARCHAR2
, NVARCHAR2
,VARBINARY
.
Notes:
Do not use the
VARCHAR
data type. UseVARCHAR2
. Even though both data types are currently synonymous, theVARCHAR
data type may be redefined as a different data type with different semantics.With the
VARCHAR2
type, a zero-length string is interpreted asNULL
. With theTT_VARCHAR
type, a zero-length string is a valid non-NULL value.VARCHAR2
uses nonpadded comparison semantics.TT_VARCHAR
uses blank-padded comparison semantics. TheTT_VARCHAR
type is supported for backward compatibility.
The following example alters table typedemo
, adding columns name5
and name6
. The name5
column is defined with typeVARCHAR2
. The name6
column is defined with TT_VARCHAR
. The example illustrates the use of nonpadded comparison semantics with columnname5
and blank-padded comparison semantics with column name6
:
Command> ALTER TABLE typedemo ADD COLUMN name5 VARCHAR2 (20);Command> ALTER TABLE typedemo ADD COLUMN name6 TT_VARCHAR (20);Command> DESCRIBE typedemo;Table USER.TYPEDEMO: Columns: NAME CHAR (20) NAME2 TT_CHAR (20) NAME3 CHAR (10 CHAR) NAME4 NCHAR (10) NAME5 VARCHAR2 (20) INLINE NAME6 TT_VARCHAR (20) INLINE1 table found.(primary key columns are indicated with *)Command> #Insert SMITH followed by 5 spaces into all columnsCommand> INSERT INTO typedemo VALUES > ('SMITH ', 'SMITH ', 'SMITH ', 'SMITH ','SMITH ', > 'SMITH');1 row inserted.Command> # Expect 0; Nonpadded comparison semanticsCommand> SELECT COUNT (*) FROM typedemo WHERE name5 = 'SMITH';< 0 >1 row found.Command> # Expect 1; Blank-padded comparison semanticsCommand> SELECT COUNT (*) FROM typedemo WHERE name6 = 'SMITH';< 1 >1 row found.Command> # Expect 1; Nonpadded comparison semanticsCommand> SELECT COUNT (*) FROM typedemo WHERE name5 > 'SMITH';< 1 >1 row found.Command> # Expect 0; Blank-padded comparison semanticsCommand> SELECT COUNT (*) FROM typedemo WHERE name6 > 'SMITH';< 0 >1 row found.
NVARCHAR2
The NVARCHAR2
data type is a variable length string of two-byte Unicode characters. When you define anNVARCHAR2
column, you define the maximum number of characters. Each value is stored exactly as you specify it. The value cannot exceed the maximum length of the column.
Note:
With theNVARCHAR2
type, a zero-length string is interpreted as NULL
. With the TT_NVARCHAR
type, a zero-length string is a valid non-NULL value.NVARCHAR2
uses nonpadded comparison semantics. TT_NVARCHAR
uses blank-padded comparison semantics. TheTT_NVARCHAR
type is supported for backward compatibility.The following example alters table typedemo
adding column name7
. Data type isNVARCHAR2
.
Command> ALTER TABLE typedemo ADD COLUMN Nnme7 NVARCHAR2 (20);Command> DESCRIBE typedemo;Table USER1.TYPEDEMO: Columns: NAME CHAR (20) NAME2 TT_CHAR (20) NAME3 CHAR (10 CHAR) NAME4 NCHAR (10) NAME5 VARCHAR2 (20) INLINE NAME6 TT_VARCHAR (20) INLINE NAME7 NVARCHAR2 (20) INLINE1 table found.
Numeric data types
Numeric types store positive and negative fixed and floating-point numbers, zero, infinity, and values that are the undefined result of an operation (NaN
, meaning not a number).
TimesTen supports both exact and approximate numeric data types. Arithmetic operations can be performed on numeric types only. Similarly,SUM
and AVG
aggregates require numeric types.
The exact numeric types are:
NUMBER
TT_BIGINT
TT_INTEGER
TT_SMALLINT
TT_TINYINT
The approximate types are:
BINARY_DOUBLE
BINARY_FLOAT
FLOAT and FLOAT(n)
NUMBER
The NUMBER
data type stores zero as well as positive and negative fixed numbers with absolute values from 1.0 x 10-130 up to but not including 1.0 x 10 126. Each NUMBER
value requires from five to 22 bytes.
Specify a fixed-point number as NUMBER(
p,s
)
, where the following holds:
The argument
p
is the precision or the total number of significant decimal digits, where the most significant digit is the left-most non-zero digit and the least significant digit is the right-most known digit.The argument
s
is the scale, or the number of digits from the decimal point to the least significant digit. The scale ranges from -84 to 127.Positive scale is the number of significant digits to the right of the decimal point up to and including the least significant digit.
Negative scale is the number of significant digits to the left of the decimal point up to but not including the least significant digit. For negative scale, the least significant digit is on the left side of the decimal point, because the number is rounded to the specified number of places to the left of the decimal point.
Scale can be greater than precision. For example, in the case of E-notation. When scale is greater than precision, the precision specifies the maximum number of significant digits to the right of the decimal point. For example, if you define the column as type NUMBER(4,5)
and you insert .000127 into the column, the value is stored as .00013. A zero is required for the first digit after the decimal point. TimesTen rounds values after the fifth digit to the right of the decimal point.
If a value exceeds the precision, then TimesTen returns an error. If a value exceeds the scale, then TimesTen rounds the value.
NUMBER(
p
)
represents a fixed-point number with precisionp
and scale 0 and is equivalent toNUMBER(
p
,0)
.
Specify a floating-point number as NUMBER
. If you do not specify precision and scale, TimesTen uses the maximum precision and scale.
The following example alters table numerics
by adding columns col6
, col7
, col8
, and col9
defined with theNUMBER
data type and specified with different precisions and scales.
Command> ALTER TABLE numerics ADD col6 NUMBER;Command> ALTER TABLE numerics ADD col7 NUMBER (4,2);Command> ALTER TABLE numerics ADD col8 NUMBER (4,-2);Command> ALTER TABLE numerics ADD col8 NUMBER (2,4);Command> ALTER TABLE numerics ADD col9 NUMBER (2,4);Command> DESCRIBE numerics;Table USER1.NUMERICS: Columns: COL1 TT_TINYINT COL2 TT_SMALLINT COL3 TT_INTEGER COL4 TT_INTEGER COL5 TT_BIGINT COL6 NUMBER COL7 NUMBER (4,2) COL8 NUMBER (4,-2) COL9 NUMBER (2,4)1 table found.(primary key columns are indicated with *)
The next example creates table numbercombo
and defines columns with theNUMBER
data type using different precisions and scales. The value 123.89 is inserted into the columns.
Command> CREATE TABLE numbercombo (col1 NUMBER, col2 NUMBER (3), > col3 NUMBER (6,2), col4 NUMBER (6,1), col5 NUMBER (6,-2));Command> DESCRIBE numbercombo;Table USER1.NUMBERCOMBO: Columns: COL1 NUMBER COL2 NUMBER (3) COL3 NUMBER (6,2) COL4 NUMBER (6,1) COL5 NUMBER (6,-2)1 table found.(primary key columns are indicated with *)Command> INSERT INTO numbercombo VALUES (123.89,123.89,123.89,123.89,123.89);1 row inserted.Command> VERTICAL ON;Command> SELECT * FROM numbercombo;COL1: 123.89 COL2: 124 COL3: 123.89 COL4: 123.9 COL5: 1001 row found.
The next example creates a table and defines a column with data type NUMBER(4,2)
. An attempt to insert a value of 123.89 results in an overflow error.
Command> CREATE TABLE invnumbervalue (col6 NUMBER (4,2));Command> INSERT INTO invnumbervalue VALUES (123.89); 2923: Number type value overflowThe command failed.
The next example creates a table and defines columns with the NUMBER
data type using a scale that is greater than the precision. Values are inserted into the columns.
Command> CREATE TABLE numbercombo2 (col1 NUMBER (4,5), col2 NUMBER (4,5), > col3 NUMBER (4,5), col4 NUMBER (2,7), col5 NUMBER (2,7), > col6 NUMBER (2,5), col7 NUMBER (2,5));Command> INSERT INTO numbercombo2 VALUES > (.01234, .00012, .000127, .0000012, .00000123, 1.2e-4, 1.2e-5);1 row inserted.Command> DESCRIBE numbercombo2;Table USER1.NUMBERCOMBO2: Columns: COL1 NUMBER (4,5) COL2 NUMBER (4,5) COL3 NUMBER (4,5) COL4 NUMBER (2,7) COL5 NUMBER (2,7) COL6 NUMBER (2,5) COL7 NUMBER (2,5)1 table found.(primary key columns are indicated with *)Command> SELECT * FROM numbercombo2;COL1: .01234 COL2: .00012 COL3: .00013 COL4: .0000012 COL5: .0000012 COL6: .00012 COL7: .000011 row found.
TT_BIGINT
The TT_BIGINT
data type is a signed integer that ranges from -9,223,372,036,854,775,808 (-263) to 9,223,372,036,854,775,807 (263-1). It requires eight bytes of storage and thus is more compact than theNUMBER
data type. It also has better performance than the NUMBER
data type. You cannot specifyBIGINT
.
This example alters table numerics
and attempts to add col5
with a data type ofBIGINT
. TimesTen generates an error. A second ALTER TABLE
successfully addscol5
with the data type TT_BIGINT
.
Command> ALTER TABLE numerics ADD COLUMN col5 BIGINT; 3300: BIGINT is not a valid type name; use TT_BIGINT insteadThe command failed.Command> ALTER TABLE numerics ADD COLUMN col5 TT_BIGINT;Command> DESCRIBE numerics;Table USER1.NUMERICS: Columns: COL1 TT_TINYINT COL2 TT_SMALLINT COL3 TT_INTEGER COL4 TT_INTEGER COL5 TT_BIGINT1 table found.(primary key columns are indicated with *)
TT_INTEGER
The TT_INTEGER
data type is a signed integer that ranges from -2,147,483,648 (-231) to 2,147,483,647 (231 -1). It requires four bytes of storage and thus is more compact than theNUMBER
data type. It also has better performance than the NUMBER
data
type. You can specify TT_INT
for TT_INTEGER
. If you specify eitherINTEGER
orINT
, these types are mapped to NUMBER(38)
.
The following example alters the table numerics
and adds col3
with the data typeINT
. Describing the table shows that the data type is NUMBER(38)
. The columncol3
is dropped. A second ALTER TABLE
adds col2
with the data typeINTEGER
. Describing the table shows that the data type is NUMBER(38)
. The columncol3
is dropped. Columns col3
and col4
are then added with the data typesTT_INTEGER
and TT_INT
. Describing the table shows both data types asTT_INTEGER
.
Command> ALTER TABLE numerics ADD col3 INT;Command> DESCRIBE numerics;Table USER1.NUMERICS: Columns: COL1 TT_TINYINT COL2 TT_SMALLINT COL3 NUMBER (38)1 table found.(primary key columns are indicated with *)Command> ALTER TABLE numerics col3;Command> ALTER TABLE numerics ADD col3 INTEGER;Command> DESCRIBE numerics;Table USER1.NUMERICS:Columns: COL1 TT_TINYINT COL2 TT_SMALLINT COL3 NUMBER (38)1 table found.(primary key columns are indicated with *)Command> ALTER TABLE numerics col3;Command> ALTER TABLE numerics ADD COLUMN col3 TT_INTEGER;Command> DESCRIBE numerics;Table USER1.NUMERICS:Columns: COL1 TT_TINYINT COL2 TT_SMALLINT COL3 TT_INTEGER1 table found.(primary key columns are indicated with *)Command> ALTER TABLE numerics ADD col4 TT_INT;Command> DESCRIBE numerics;Table USER1.NUMERICS:Columns: COL1 TT_TINYINT COL2 TT_SMALLINT COL3 TT_INTEGER COL4 TT_INTEGER1 table found.(primary key columns are indicated with *)
TT_SMALLINT
The TT_SMALLINT
data type is a signed integer that ranges from -32,768 (-215) to 32,767 (215-1). It requires two bytes of storage and thus is more compact than theNUMBER
data type. It also has better performance than theNUMBER
data type. You can specify the data typeSMALLINT
, but it maps to NUMBER(38)
.
The following example alters the table numerics
and adds col2
with the data typeSMALLINT
. Describing the table shows that the data type is NUMBER(38)
. The columncol2
is dropped. A second ALTER TABLE
adds col2
with the data typeTT_SMALLINT
.
Command> ALTER TABLE numerics ADD COLUMN col2 SMALLINT;Command> DESCRIBE Numerics;Table USER1.NUMERICS: Columns: COL1 TT_TINYINT COL2 NUMBER (38)1 table found.(primary key columns are indicated with *)Command> ALTER TABLE numerics COLUMN col2;Command> ALTER TABLE numerics ADD COLUMN col2 TT_SMALLINT;Command> DESCRIBE numerics;Table USER1.NUMERICS: Columns: COL1 TT_TINYINT COL2 TT_SMALLINT1 table found.(primary key columns are indicated with *)
TT_TINYINT
The TT_TINYINT
data type is an unsigned integer that ranges from 0 to 255 (28 -1). It requires one byte of storage and thus is more compact than theNUMBER
data type. It also has better performance than the NUMBER
data type. The data type of a negativeTT_TINYINT
is TT_SMALLINT
. You cannot specify TINYINT
.
The following example first attempts to create a table named numerics
that defines a column namedcol1
with data type TINYINT
. TimesTen returns an error. The example then redefines the column with data typeTT_TINYINT
.
Command> CREATE TABLE numerics (col1 TINYINT); 3300: TINYINT is not a valid type name; use TT_TINYINT insteadThe command failed.Command> CREATE TABLE numerics (col1 TT_TINYINT);Command> DESCRIBE numerics;Table USER1.NUMERICS: Columns: COL1 TT_TINYINT1 table found.(primary key columns are indicated with *)
Floating-point numbers
Floating-point numbers can be with or without a decimal point. An exponent may be used to increase the range (for example, 1.2E-20).
Floating-point numbers do not have a scale because the number of digits that can appear after the decimal point is not restricted.
Binary floating-point numbers are stored using binary precision (the digits 0 and 1). For theNUMBER
data type, values are stored using decimal precision (the digits 0 through 9).
Literal values that are within the range and precision supported by NUMBER
are stored asNUMBER
because literals are expressed using decimal precision.
Use one of the following data types for floating-point numbers:
BINARY_DOUBLE
BINARY_FLOAT
FLOAT and FLOAT(n)
BINARY_DOUBLE
BINARY_DOUBLE
is a 64-bit, double-precision, floating-point number.
Both BINARY_FLOAT
and BINARY_DOUBLE
support the special valuesInf
, -Inf
, and NaN
(not a number) and conform to the IEEE standard.
Floating-point number limits:
BINARY_FLOAT
Minimum positive finite value: 1.17549E-38F
Maximum positive finite value: 3.40282E+38F
BINARY_DOUBLE
Minimum positive finite value: 2.22507485850720E-308
Maximum positive finite value: 1.79769313486231E+308
The following example creates a table and defines two columns with the BINARY_FLOAT
andBINARY_DOUBLE
data types.
Command> CREATE TABLE BfBd (Col1 BINARY_FLOAT, Col2 BINARY_DOUBLE);Command> DESCRIBE BfBd;Table UISER1.BFBD: Columns: COL1 BINARY_FLOAT COL2 BINARY_DOUBLE1 table found.(primary key columns are indicated with *)
BINARY_FLOAT
BINARY_FLOAT
is a 32-bit, single-precision, floating-point number.
FLOAT and FLOAT(n)
TimesTen also supports the ANSI type FLOAT
. FLOAT
is an exact numeric type and is implemented as theNUMBER
type. The value of n
indicates the number of bits of precision that can be stored, from 1 to 126. To convert from binary precision to decimal precision, multiplyn
by 0.30103. To convert from decimal precision to binary precision, multiply the decimal precision by 3.32193. The maximum 126 digits of binary precision is equivalent to approximately 38 digits of decimal precision.
BINARY and VARBINARY data types
The BINARY
data type is a fixed-length binary value with a length ofn
bytes, where the value of n
ranges from 1 to 8300 bytes. The BINARY
data type requires n
bytes of storage. Data is padded to the maximum column size with trailing zeros. Zero padded comparison semantics are used.
The VARBINARY
data type is a variable-length binary value having a maximum length ofn
bytes, where the value of n
ranges from 1 to 4,194,304 (222) bytes.
The following example creates a table and defines two columns: col1
is defined with data typeBINARY
and col2
with data type VARBINARY
. Then, binary data is inserted into each column. Note that theBINARY
value is padded to the right with zeros.
Note:
For details on assigning hexadecimal literals as binary data in TimesTen, see the description for theHexadecimalLiteral
in "Constants".Command> CREATE TABLE bvar (col1 BINARY (10), col2 VARBINARY (10));Command> DESCRIBE bvar;Table USER1.BVAR: Columns: COL1 BINARY (10) COL2 VARBINARY (10) INLINE1 table found.(primary key columns are indicated with *)Command> INSERT INTO bvar (col1, col2) > VALUES (0x4D7953514C, 0x39274D);1 row inserted.Command> select * from bvar; < 4D7953514C0000000000, 39274D >1 row found.
Numeric precedence
The result type of an expression is determined by the operand with the highest type precedence. The numeric precedence order is as follows (highest to lowest):
BINARY_DOUBLE
BINARY_FLOAT
NUMBER
TT_BIGINT
TT_INTEGER
TT_SMALLINT
TT_TINYINT
For example, the sum of TT_INTEGER
and BINARY_FLOAT
values is typeBINARY_FLOAT
because BINARY_FLOAT
has higher numeric precedence. Similarly, the product ofNUMBER
and BINARY_DOUBLE
values is type BINARY_DOUBLE
.
LOB data types
The large object (LOB) data types can store large and unstructured data such as text, image, video, and spatial data. LOBs include theBLOB
, CLOB
and NCLOB
data types.
You can insert or update data in a column that is of a LOB data type. For update operations, you can set the LOB value toNULL
, an empty value through EMPTY_CLOB
or EMPTY_BLOB
, or replace the entire LOB with new data. You can update a LOB value with another LOB value. If you delete a row containing a LOB column, you also delete the LOB value.
LOB data type semantics are similar to the following SQL semantics:
BLOB
data types use SQLVARBINARY
semantics.CLOB
data types use SQLVARCHAR2
semantics.NCLOB
data types use SQLNVARCHAR2
semantics.
The following SQL statements, operators, and functions accept one or more of the LOB data types as arguments.
SQL statements:
CREATE TABLE
,SELECT
,INSERT
, andUPDATE
.Operators:
LIKE
andIS [NOT] NULL
.Functions:
ASCIISTR
,CONCAT
,INSTR
,INSTRB
,INSTR4
,LENGTH
,LENGTHB
,LOWER
,LPAD
,NLSSORT
,NVL
,TRIM
,LTRIM
,RTRIM
,SUBSTR
,SUBSTRB
,SUBSTR4
,REPLACE
,RPAD
,SOUNDEX
,TO_DATE
,TO_NUMBER
,TO_CHAR
, andUPPER
.
Note:
Support for LOB data types are detailed in the appropriate SQL operator, statement and function documentation.Description
LOB conversion SQL functions (TO_BLOB,TO_CLOB, and TO_LOB) convert to the desired LOB data type.
LOB columns are always stored out of line, so you cannot use the
INLINE
attribute when declaring LOB columns.You can define multiple columns of the LOB data type within a single table.
You cannot create a primary key, unique index, or unique constraint on LOB columns.
You cannot create a materialized view if the detail table contains a LOB column.
In addition to SQL, you can use LOB specific APIs in PL/SQL, ODBC, JDBC, OCI, and PRO*C/C++ for creating and updating LOBs. See the appropriate TimesTen developer's guide for more information on these APIs.
The following sections describe each LOB data type in more detail:
BLOB
CLOB
NCLOB
In addition, the following sections provide more details on LOBs in general:
Difference between NULL and empty LOBs
Initializing LOBs
BLOB
The Binary LOB (BLOB
) data type stores unstructured binary large objects. The maximum size forBLOB
data is 16 MB.
Note:
For details on assigning hexadecimal literals as binary data in TimesTen, see the description for theHexadecimalLiteral
in "Constants".When you define a BLOB
in a column, you do not define the maximum number of characters as you would withVARBINARY
and other variable length data types. Instead, the definition for the column would be as follows:
Command> CREATE TABLE blob_content ( > id NUMBER PRIMARY KEY, > blob_column BLOB );
To manipulate a BLOB
, the following functions are provided:
There are two methods to initialize a
BLOB
, including theEMPTY_BLOB
function to initialize an emptyBLOB
. For details on initializing aBLOB
, see "Initializing LOBs". For details on how an empty LOB is different from aNULL
LOB, see "Difference between NULL and empty LOBs".To convert a binary value to a
BLOB
, use theTO_LOB
orTO_BLOB
functions. See "TO_BLOB" and "TO_LOB"for more details.
CLOB
The Character LOB (CLOB
) data type stores single-byte and multibyte character data. The maximum size forCLOB
data is 4 MB. The maximum number of characters that can be stored in theCLOB
depends on whether you are using a single or multibyte character set.
When you define a CLOB
in a column, you do not define the maximum number of characters as you would withVARCHAR
and other variable length data types. Instead, the definition for the column would be as follows:
Command> CREATE TABLE clob_content ( > id NUMBER PRIMARY KEY, > clob_column CLOB );
To manipulate a CLOB
, the following functions are provided:
There are two methods to initialize a
CLOB
, including theEMPTY_CLOB
function to initialize an emptyCLOB
. For details on initializing aCLOB
, see "Initializing LOBs". For details on how an empty LOB is different from aNULL
LOB, see "Difference between NULL and empty LOBs".To convert a character string to a
CLOB
, use theTO_LOB
orTO_CLOB
functions. See "TO_CLOB" and"TO_LOB" for more details.
NCLOB
The National Character LOB (NCLOB
) data type stores Unicode data. The maximum size for anNCLOB
data is 4 MB.
When you define a NCLOB
in a column, you do not define the maximum number of characters as you would withVARCHAR
and other variable length data types. Instead, the definition for the column would be as follows:
Command> CREATE TABLE nclob_content ( > id NUMBER PRIMARY KEY, > nclob_column NCLOB );
The following functions support the NCLOB
data type:
There are two methods to initialize an
NCLOB
, including theEMPTY_CLOB
function to initialize an emptyNCLOB
. For details on initializing aNCLOB
, see "Initializing LOBs". For details on how an empty LOB is different from aNULL
LOB, see "Difference between NULL and empty LOBs".To convert a character string to an
NCLOB
, use theTO_LOB
orTO_CLOB
functions. See "TO_CLOB" and"TO_LOB" for more details.
Difference between NULL and empty LOBs
A NULL
LOB is not the same as an empty LOB.
A
NULL
LOB has the value ofNULL
, soNULL
is returned if you request aNULL
LOB.An empty LOB is initialized with either the
EMPTY_CLOB
orEMPTY_BLOB
functions. These functions initialize the LOB to be a zero-length, non-NULL
value. You can also use theEMPTY_CLOB
orEMPTY_BLOB
functions to initialize a LOB in a non-nullable column.
Initializing LOBs
You can initialize a LOB in one of two ways:
You can insert an empty LOB into a
BLOB
,CLOB
orNCLOB
column by using theEMPTY_BLOB
orEMPTY_CLOB
functions. This is useful when you do not have any data, but want to create the LOB in preparation for data. It is also useful for initializing non-nullable LOB columns.Initialize the LOB by inserting data directly. There is no need to initialize a LOB using the
EMPTY_BLOB
orEMPTY_CLOB
functions, you can simply insert the data directly.
The following demonstrates examples of each type of initialization:
You can initialize a LOB with the EMPTY_CLOB
function, as shown with the following example:
Command> INSERT INTO clob_content (id, clob_column) > VALUES (1, EMPTY_CLOB( ) );1 row inserted.
You can initialize a LOB by inserting data directly, as shown with the following example:
Command> INSERT INTO clob_content(id, clob_column) > VALUES (4, 'Demonstration of the LOB initialization.');1 row inserted.
You can initialize or update an existing LOB value with the UPDATE
statement, as shown with the following examples:
Command> UPDATE blob_content > SET blob_column = 0x000AF4511 > WHERE id = 1;1 row updated.Command> select * from blob_content; < 1, 0000AF4511 >1 rows found.Command> UPDATE clob_content > SET clob_column = 'Demonstration of the CLOB data type ' > WHERE id = 1;1 row updated.Command> SELECT * FROM clob_content; < 1, Demonstration of the CLOB data type >
ROWID data type
The address of a row in a table or materialized view is called arowid. The rowid data type is ROWID
. You can examine a rowid by querying theROWID
pseudocolumn. See "ROWID" for details on the ROWID
pseudocolumn.
Specify literal ROWID
values in SQL statements as constants enclosed in single quotes, as follows:
Command> SELECT ROWID, last_name > FROM employees > WHERE department_id = 20;< BMUFVUAAACOAAAALhM, Hartstein >< BMUFVUAAACOAAAAMhM, Fay >2 rows found.Command> SELECT ROWID, last_name FROM employees > WHERE ROWID='BMUFVUAAACOAAAALhM';< BMUFVUAAACOAAAALhM, Hartstein >1 row found.
The ROWID
data type can be used as follows:
As the data type for a table column or materialized view column
In these types of expressions:
Literals
Comparisons:
<
,<=
,>
,>=
,BETWEEN
CASE expressions
CAST
COALESCE
COUNT
DECODE
GREATEST
IN
IS NULL
LEAST
MAX
MIN
NVL
TO_CHAR
TT_HASH
In
ORDER BY
andGROUP BY
clausesIn
INSERT...SELECT
statements. Columncol1
has been defined with theROWID
data type for these examples:Command> DESCRIBE master; Table MYUSER.MASTER: Columns: *ID ROWID NOT NULL NAME CHAR (30) 1 table found.(primary key columns are indicated with *)Command> INSERT INTO master(id, name) SELECT ROWID, last_name FROM employees;107 rows inserted.Command> SELECT * FROM master;< BMUFVUAAACOAAAAGhG, King >< BMUFVUAAACOAAAAHhG, Kochhar >< BMUFVUAAACOAAAAIhG, De Haan >...107 rows found.
You can use the
TO_CHAR
function with theROWID
pseudocolumn as shown below:Command> INSERT INTO master(id, name) > SELECT TO_CHAR(ROWID), last_name FROM employees;107 rows inserted.Command> SELECT * FROM master;< BMUFVUAAACOAAAAGhG, King >< BMUFVUAAACOAAAAHhG, Kochhar >...107 rows found.
You can use the
CAST
function with theROWID
pseudocolumn as shown below:Command> CREATE TABLE master (id CHAR(20) NOT NULL PRIMARY KEY, > name CHAR(30));Command> INSERT INTO master(id, name) SELECT CAST(ROWID AS CHAR(20)), > last_name from employees;107 rows inserted.
Implicit type conversions are supported for assigning values and comparison operations betweenROWID
and CHAR
or between ROWID
and VARCHAR2
data.
When CHAR
, VARCHAR2
, and ROWID
operands are combined inCOALESCE
,DECODE
,NVL
, orCASE expressions
, the result data type isROWID
. Expressions with CHAR
and VARCHAR2
values are converted toROWID
values to evaluate the expression.
To use ROWID
values with string functions such as CONCAT
, the application must convertROWID
values explicitly toCHAR
values using the SQL TO_CHAR
function.
Datetime data types
The datetime data types are as follows:
DATE
TIME
TIMESTAMP
TT_DATE
TT_TIMESTAMP
DATE
The format of a DATE
value is YYYY-MM-DD HH:MI:SS
and ranges from -4712-01-01 (January 1, 4712 BC) to 9999-12-31 (December 31, 9999 AD). There are no fractional seconds. TheDATE
type requires seven bytes of storage.
TimesTen does not support user-specified NLS_DATE_FORMAT
settings. The SQLTO_CHAR
andTO_DATE
functions can be used to specify other formats.
TIME
The format of a TIME
value is HH:MI:SS
and ranges from 00:00:00 (midnight) to 23:59:59 (11:59:59 pm). TheTIME
data type requires eight bytes of storage.
TIMESTAMP
The format of a TIMESTAMP
value is YYYY-MM-DD HH:MI:SS [.FFFFFFFFF]
. The fractional seconds precision range is 0 to 9. The default is 6. The date range is from -4712-01-01 (January 1, 4712 BC) to 9999-12-31 (December 31, 9999 AD). The TIMESTAMP
type requires 12 bytes of storage. The TIMESTAMP
type has a larger date range and supports more precision thanTT_TIMESTAMP
.
TimesTen does not support user-specified NLS_TIMESTAMP_FORMAT
settings. The SQLTO_CHAR
andTO_DATE
functions can be used to specify other formats.
TT_DATE
The format of a TT_DATE
value is YYYY-MM-DD
and ranges from 1753-01-01 (January 1, 1753 AD) to 9999-12-31 (December 31, 9999 AD). TheTT_DATE
data type requires four bytes of storage.
TT_TIMESTAMP
The format of a TT_TIMESTAMP
value is YYYY-MM-DD HH:MI:SS [.FFFFFFFFF]
. The fractional seconds precision is 6. The range is from 1753-01-01 00:00:00 (January 1, 1753, midnight) to 9999-12-31 23:59:59 (December 31, 9999, 11:59:59 PM). The TT_TIMESTAMP
type requires eight bytes of storage. TT_TIMESTAMP
is faster than theTIMESTAMP
data type and has a smaller storage size.
TimesTen intervals
This section includes the following topics:
Using interval data types
Using DATE and TIME data types
Handling timezone conversions
Datetime and interval data types in arithmetic operations
Using interval data types
If you are using TimesTen type mode, refer to the Oracle TimesTen In-Memory Database API and SQL Reference Guide, Release 6.0.3, for information on interval types.
TimesTen supports interval types only in a constant specification or intermediate expression result. Interval types cannot be the final result. Columns cannot be defined with an interval type. See"Type specifications".
You can specify a single-field literal that is an interval in an expression, but you cannot specify a complete expression that returns an interval data type. Instead, theEXTRACT
function must be used to extract the desired component of the interval result.
TimesTen supports interval literals of the following form:
INTERVAL [+/-]
CharString
IntervalQualifier
Using DATE and TIME data types
This section shows some DATE
,TIME
, and TIMESTAMP
data type examples:
To create a table named sample
that contains a column dcol
of typeDATE
and a column tcol
of type TIME
, use the following:
CREATE TABLE sample (tcol TIME, dcol DATE);
To insert DATE
and TIME
values into the sample
table, use this:
INSERT INTO sample VALUES (TIME '12:00:00', DATE '1998-10-28');
To select all rows in the sample
table that are between noon and 4:00 p.m. on October 29, 1998, use the following:
SELECT * FROM sample WHERE dcol = DATE '1998-10-29' AND tcol BETWEEN TIME '12:00:00' AND TIME '16:00:00';
To create a table named sample2
that contains a column tscol
of typeTIMESTAMP
and then select all rows in the table that are between noon and 4:00 p.m. on October 29, 1998, use these statements:
CREATE TABLE sample2 (tscol TIMESTAMP);INSERT INTO sample2 VALUES (TIMESTAMP '1998-10-28 12:00:00');SELECT * FROM sample2 WHERE tscolBETWEEN TIMESTAMP '1998-10-29 12:00:00' AND '1998-10-29 16:00:00';
Note:
TimesTen enables both literal and string formats of theTIME
, DATE
, and TIMESTAMP
types. For example,timestring ('12:00:00')
andtimeliteral (TIME '16:00:00')
are both valid ways to specify a TIME
value. TimesTen reads the first value as CHAR
type and later converts it toTIME
type as needed. TimesTen reads the second value as TIME
. The examples above use the literal format. Any values for the fraction not specified in full microseconds result in a "Data truncated
" error.Handling timezone conversions
TimesTen does not support TIMEZONE
.TIME
and TIMESTAMP
data type values are stored without making any adjustment for time difference. Applications must assume one time zone and convertTIME
and TIMESTAMP
to that time zone before sending values to the database. For example, an application can assume its time zone to be Pacific Standard Time. If the application is usingTIME
and TIMESTAMP
values from Pacific Daylight Time or Eastern Standard Time, for example, the application must convertTIME
and TIMESTAMP
to Pacific Standard Time.
Datetime and interval data types in arithmetic operations
If you are using TimesTen type mode, see Oracle TimesTen In-Memory Database API and SQL Reference Guide, Release 6.0.3, for information about datetime and interval types in arithmetic operations
You can perform numeric operations on date, timestamp and interval data. TimesTen calculates the results based on the rules:
You can add or subtract a numeric value to or from a
ORA_DATE
orORA_TIMESTAMP
value. TimesTen internally convertsORA_TIMESTAMP
values toORA_DATE
values.You can add or subtract a numeric value to or from a
TT_DATE
orTT_TIMESTAMP
value and the resulting value isTT_DATE
orTT_TIMESTAMP
respectively.Numeric values are treated as number of days. For example,
SYSDATE
+ 1 is tomorrow.SYSDATE
- 7 is one week ago.Subtracting two date columns results in the number of days between the two dates. The return type is numeric.
You cannot add date values. You cannot multiple or divide date or timestamp values.
Table 1-5 is a matrix of datetime arithmetic operations. Dashes represent operations that are not supported. The matrix assumes that you are using Oracle type mode:
Table 1-5 DateTime arithmetic operations
DATE
+ (plus)
—
—
—
—
DATE
DATE
- (minus)
NUMBER
NUMBER
INTERVAL
INTERVAL
DATE
DATE
* (multiply)
—
—
—
—
—
—
/ (divide)
—
—
—
—
—
—
TT_DATE
+ (plus)
—
—
—
—
TT_DATE
TT_DATE
- (minus)
NUMBER
TT_BIGINT
INTERVAL
INTERVAL
TT_DATE
TT_DATE
* (multiply)
—
—
—
—
—
—
/ (divide)
—
—
—
—
—
—
TIMESTAMP
+ (plus)
—
—
—
—
DATE
TIMESTAMP
- (minus)
INTERVAL
INTERVAL
INTERVAL
INTERVAL
DATE
TIMESTAMP
* (multiply)
—
—
—
—
—
—
/ (divide)
—
—
—
—
—
—
TT_TIMESTAMP
+ (plus)
—
—
—
—
TT_TIMESTAMP
TT_TIMESTAMP
- (minus)
INTERVAL
INTERVAL
INTERVAL
INTERVAL
TT_TIMESTAMP
TT_TIMESTAMP
* (multiply)
—
—
—
—
—
—
/ (divide)
—
—
—
—
—
—
NUMERIC
+ (plus)
DATE
TT_DATE
DATE
TT_TIMESTAMP
Not applicable
—
- (minus)
—
—
—
—
Not applicable
—
* (multiply)
—
—
—
—
Not applicable
INTERVAL
/ (divide)
—
—
—
—
Not applicable
—
INTERVAL
+ (plus)
DATE
TT_DATE
TIMESTAMP
TT_TIMESTAMP
—
INTERVAL
- (minus)
—
—
—
—
INTERVAL
* (multiply)
—
—
—
—
INTERVAL
—
/ (divide)
—
—
—
—
INTERVAL
—
Note:
An interval data type cannot be the final result of a complete expression. TheEXTRACT
function must be used to extract the desired component of this interval result.SELECT tt_date1 - tt_date2 FROM t1;SELECT EXTRACT(DAY FROM timestamp1-timestamp2) FROM t1;SELECT * FROM t1 WHERE timestamp1 - timestamp2 = NUMTODSINTERVAL(10, 'DAY');SELECT SYSDATE + NUMTODSINTERVAL(20,'SECOND') FROM dual;SELECT EXTRACT (SECOND FROM timestamp1-timestamp2) FROM dual;/* select the microsecond difference between two timestamp values d1 and d2 */SELECT 1000000*(EXTRACT(DAY FROM d1-d2)*24*3600+EXTRACT(HOUR FROM d1-d2)*3600+EXTRACT(MINUTE FROM d1-d2)*60+EXTRACT(SECOND FROM d1-d2) FROM d1;
This example inserts TIMESTAMP
values into two columns and then subtracts the two values using theEXTRACT
function:
Command> CREATE TABLE ts (id TIMESTAMP, id2 TIMESTAMP);Command> INSERT INTO ts VALUES (TIMESTAMP '2007-01-20 12:45:23', > TIMESTAMP '2006-12-25 17:34:22');1 row inserted.Command> SELECT EXTRACT (DAY FROM id - id2) FROM ts;< 25 >1 row found.
The following queries return errors. You cannot select an interval result:
SELECT timestamp1 - timestamp2 FROM t1;
You cannot compare an INTERVAL YEAR TO MONTH
with an INTERVAL DAY TO SECOND
:
SELECT * FROM t1 WHERE timestamp1 - timestamp2 = NUMTOYMINTERVAL(10, 'YEAR');
You cannot compare an INTERVAL DAY TO SECOND
with an INTERVAL DAY
:
SELECT * FROM t1 WHERE timestamp1 - timestamp2 = INTERVAL '10' DAY;
You cannot extract YEAR
from an INTERVAL DAY TO SECOND
:
SELECT EXTRACT (YEAR FROM timestamp1 - timestamp2) FROM dual;
Restrictions on datetime and interval arithmetic operations
Consider these restrictions when performing datetime and interval arithmetic:
The results for addition and subtraction with
DATE
andTIMESTAMP
types forINTERVAL YEAR
andINTERVAL MONTH
are not closed. For example, adding one year to theDATE
orTIMESTAMP
of '2004-02-29' results in a date arithmetic error (TimesTen error 2787) because February 29, 2005 does not exist (2005 is not a leap year). AddingINTERVAL '1'
month toDATE '2005-01-30'
also results in the same error because February never has 30 days.The results are closed for
INTERVAL DAY
.An interval data type cannot be the final result of a complete expression. The
EXTRACT
function must be used to extract the desired component of the interval result.
Storage requirements
Variable-length columns whose declared column length is greater than 128 bytes are stored out of line. Variable-length columns whose declared column length is less than or equal to 128 bytes are stored inline. All LOB data types are stored out of line.
For character semantics, the number of bytes stored out of line is dependent on the character set. For example, for a character set with four bytes per character, variable-length columns whose declared column length is greater than 32 (128/4) are stored out of line.
Table 1-6 shows thestorage requirements of the various data types.
Table 1-6 Data type storage requirements
BINARY(
n
)
n
bytes.
BINARY_DOUBLE
Eight bytes.
BINARY_FLOAT
Four bytes.
CHAR(
n
[BYTE|CHAR])
n
bytes or, if character semantics,n
characters. If character semantics, the length of the column (n
) is based on length semantics and character set.
DATE
Seven bytes.
Interval
An interval type cannot be stored in TimesTen.
NCHAR(
n
)
Bytes required is 2*n
wheren
is the number of characters.
NUMBER
Five to 22 bytes.
NVARCHAR2(
n
)
For NOT INLINE
columns:
On 32-bit platforms, 2*(length of value) + 20 bytes (minimum of 28 bytes).
On 64-bit platforms, 2*(length of value) + 24 bytes (minimum of 40 bytes).
For INLINE
columns:
On 32-bit platforms, 2*(length of column) + 4 bytes.
On 64-bit platforms, 2*(length of column) + 8 bytes.
ROWID
Twelve bytes.
TIMESTAMP
Twelve bytes.
TT_BIGINT
Eight bytes.
TT_DATE
Four bytes.
TT_DECIMAL(
p,s
)
Approximately p
/2 bytes.
TT_INT[EGER
]
Four bytes.
TT_SMALLINT
Two bytes.
TT_TIME
Eight bytes.
TT_TIMESTAMP
Eight bytes.
TT_TINYINT
One byte.
VARBINARY(
n
)
For NOT INLINE
columns:
On 32-bit platforms, length of value + 20 bytes (minimum of 28 bytes).
On 64-bit platforms, length of value + 24 bytes (minimum of 40 bytes).
For INLINE
columns:
On 32-bit platforms, length of column + 4 bytes.
On 64-bit platforms, length of column + 8 bytes.
VARCHAR2(
n
[BYTE|CHAR])
For NOT INLINE
columns:
On 32-bit platforms, length of value + 20 bytes (minimum of 28 bytes). NULL
value is stored as (null bit) + 4 bytes, or 4.125 bytes.
On 64-bit platforms, length of value + 24 bytes (minimum of 40 bytes). NULL
value is stored as (null bit) + 8 bytes, or 8.125 bytes.
This storage principal holds for all variable length NOT INLINE
data types:TT_VARCHAR
, TT_NVARCHAR
, VARCHAR2
, NVARCHAR2
, andVARBINARY
.
For INLINE
columns:
On 32-bit platforms, n
+ 4 bytes.NULL
value is stored as (null bit) + n
+ 4 bytes.
On 64-bit platforms, n + 8 bytes. NULL
value is stored as (null bit) +n
+ 8 bytes.
If character semantics, the length of the column (n
) is based on length semantics and character set.
BLOB
and CLOB
On 32-bit platforms, length of value + 36 bytes (minimum of 40 bytes).
On 64-bit platforms, length of value + 48 bytes (minimum of 56 bytes).
NCLOB
On 32-bit platforms, 2 * (length of value) + 36 bytes (minimum of 40 bytes).
On 64-bit platforms, 2 * (length of value) + 48 bytes (minimum of 56 bytes).
Data type comparison rules
This section describes how values of each data type are compared in TimesTen.
Numeric values
A larger value is greater than a smaller value: -1 is less than 10, and -10 is less than -1.
The floating-point value NaN
is greater than any other numeric value and is equal to itself.
Date values
A later date is considered greater than an earlier one. For example, the date equivalent of '10-AUG-2005' is less than that of '30-AUG-2006', and '30-AUG-2006 1:15 pm' is greater than '30-AUG-2006 10:10 am'.
Character values
Character values are compared in the following ways:
Binary and linguistic sorting
Blank-padded and nonpadded comparison semantics
Binary and linguistic sorting
In binary sorting, TimesTen compares character strings according to the concatenated value of the numeric codes of the characters in the database character set. One character is greater than the other if it has a greater numeric values than the other in the character set. Blanks are less than any character.
Linguistic sorting is useful if the binary sequence of numeric codes does not match the linguistic sequence of the characters you are comparing. In linguistic sorting, SQL sorting and comparison are based on the linguistic rule set byNLS_SORT
. For more information on linguistic sorts, see "Linguistic sorts" in Oracle TimesTen In-Memory Database Operations Guide.
The default is binary sorting.
Blank-padded and nonpadded comparison semantics
With blank-padded semantics, if two values have different lengths, TimesTen adds blanks to the shorter value until both lengths are equal. Values are then compared character by character up to the first character that differs. The value with the greater character in the first differing position is considered greater. If two values have no differing characters, then they are considered equal. Thus, two values are considered equal if they differ only in the number of trailing blanks.
Blank-padded semantics are used when both values in the comparison are expressions of typeCHAR
or NCHAR
or text literals.
With nonpadded semantics, two values are compared, character by character, up to the first character that differs. The value with the greater character in that position is considered greater. If two values that have differing lengths are identical up to the end of the shorter one, then the longer one is considered greater. If two values of equal length have no differing characters, they are considered equal.
Nonpadded semantics are used when both values in the comparison have the type VARCHAR2
or NVARCHAR2
.
An example with blank-padded semantics:
'a ' = 'a'
An example with nonpadded semantics:
'a ' > 'a'
Data type conversion
Generally an expression cannot contain values of different data types. However, TimesTen supports both implicit and explicit conversion from one data type to another. Because algorithms for implicit conversion are subject to change across software releases and the behavior of explicit conversions is more predictable, TimesTen recommends explicit conversion.
Implicit data type conversion
TimesTen converts a value from one data type to another when such a conversion makes sense.
Table 1-7 andTable 1-8 use a matrix to illustrate TimesTen implicit data type conversions.YES
in the cell indicates the conversion is supported. NO
in the cell indicates the conversion is not supported. The rules for implicit conversion follow the table.
Table 1-7 Implicit data type conversion
CHAR
—
YES
YES
YES
YES
YES
YES
YES
VARCHAR2
YES
—
YES
YES
YES
YES
YES
YES
NCHAR
YES
YES
—
YES
YES
YES
YES
YES
NVARCHAR2
YES
YES
YES
—
YES
YES
YES
YES
DATE
YES
YES
YES
YES
—
YES
YES
YES
TT_DATE
YES
YES
YES
YES
YES
—
YES
YES
TIMESTAMP
YES
YES
YES
YES
YES
YES
—
YES
TT_TIMESTAMP
YES
YES
YES
YES
YES
YES
YES
—
NUMERIC
YES
YES
YES
YES
NO
NO
NO
NO
BLOB
NO
NO
NO
NO
NO
NO
NO
NO
CLOB
YES
YES
YES
YES
NO
NO
NO
NO
NCLOB
YES
YES
YES
YES
NO
NO
NO
NO
BINARY/VARBINARY
YES
YES
YES
YES
NO
NO
NO
NO
ROWID
YES
YES
YES
YES
NO
NO
NO
NO
Table 1-8 Implict data type conversion (continued)
CHAR
YES
YES
YES
YES
YES
YES
VARCHAR2
YES
YES
YES
YES
YES
YES
NCHAR
YES
YES
YES
YES
YES
YES
NVARCHAR2
YES
YES
YES
YES
YES
YES
DATE
NO
NO
NO
NO
NO
NO
TT_DATE
NO
NO
NO
NO
NO
NO
TIMESTAMP
NO
NO
NO
NO
NO
NO
TT_TIMESTAMP
NO
NO
NO
NO
NO
NO
NUMERIC
—
NO
NO
NO
NO
NO
BLOB
NO
—
NO
NO
YES
NO
CLOB
NO
NO
—
YES
NO
NO
NCLOB
NO
NO
YES
—
NO
NO
BINARY/VARBINARY
NO
YES
YES
YES
—
NO
ROWID
NO
NO
NO
NO
NO
—
The following rules apply:
During arithmetic operations on and comparisons between character and non-character data types, TimesTen converts from any character data type to a numeric or datetime data type as appropriate. In arithmetic operations between
CHAR
/VARCHAR2
andNCHAR
/NVARCHAR2
, TimesTen converts to aNUMBER
.During arithmetic operations, floating point values
INF
andNAN
are not supported when converting character values to numeric values.During concatenation operations, TimesTen converts non-character data types to
CHAR
,NCHAR
,VARCHAR2
, orNVARCHAR2
depending on the other operand.When comparing a character value with a numeric value, TimesTen converts the character data to a numeric value.
When comparing a character value with a datetime value, TimesTen converts the character data to a datetime value.
During conversion from a timestamp value to a
DATE
value, the fractional seconds portion of the timestamp value is truncated.Conversions from
BINARY_FLOAT
toBINARY_DOUBLE
are exact.Conversions from
BINARY_DOUBLE
toBINARY_FLOAT
are inexact if theBINARY_DOUBLE
value uses more bits of precision that supported by theBINARY_FLOAT
.Conversions between either character values or exact numeric values (
TT_TINYINT
,TT_SMALLINT
,TT_INTEGER
,TT_BIGINT
,NUMBER
) and floating-point values (BINARY_FLOAT
,BINARY_DOUBLE
) can be inexact because the character values and the exact numeric values use decimal precision whereas the floating-point numbers use binary precision.When manipulating numeric values, TimesTen usually adjusts precision and scale to allow for maximum capacity. In such cases, the numeric data type resulting from such operations can differ from the numeric data type found in the underlying tables.
When making assignments, TimesTen converts the value on the right side of the equal sign (=) to the data type of the target of the assignment on the left side.
When you use a SQL function or operator with an argument of a data type other than the one it accepts, TimesTen converts the argument to the accepted data type so long as TimesTen supports the implicit conversion. For more information on supported data type conversions, see Implicit data type conversion.
During
INSERT
,INSERT... SELECT
, andUPDATE
operations, TimesTen converts the value to the data type of the affected column.Implicit and explicit
CHAR
/VARCHAR2
<->NCHAR
/NVARCHAR
2 conversions are supported except when the character set isTIMESTEN8
. An example of implicit conversion:Command> CREATE TABLE convdemo (c1 CHAR (10), x1 TT_INTEGER);Command> CREATE TABLE convdemo2 (c1 NCHAR (10), x2 TT_INTEGER);Command> INSERT INTO convdemo VALUES ('ABC', 10);1 row inserted.Command> INSERT INTO convdemo VALUES ('def', 100);1 row inserted.Command> INSERT INTO convdemo2 SELECT * FROM convdemo;2 rows inserted.Command> SELECT x1,x2,convdemo.c1, convdemo2.c1 > FROM convdemo, convdemo2 where Ccnvdemo.c1 = convdemo2.c1;X1, X2, C1, C1< 10, 10, ABC , ABC >< 100, 100, def , def >2 rows found.
Null values
The value NULL
indicates the absence of a value. It is a placeholder for a value that is missing. Use aNULL
when the actual value is not known or when a value would not be meaningful. Do not useNULL
to represent a numeric value of zero, because they are not equivalent. Any parameter in an expression can containNULL
regardless of its data type. In addition, any column in a table can containNULL
, regardless of its data type, unless you specifyNOT NULL
orPRIMARY KEY
integrity constraints for the column when you create the table.
The following properties of NULL
affect operations on rows, parameters, or local variables:
By default,
NULL
is sorted as the highest value in a sequence of values. However, you can modify the sort order value forNULL
withNULLS FIRST
orNULLS LAST
in theORDER BY
clause.Two
NULL
values are not equal to each other except in aGROUP BY
orSELECT DISTINCT
operation.An arithmetic expression containing a
NULL
evaluates toNULL
. In fact, all operators (except concatenation) returnNULL
when given aNULL
operand. For example,(5-col)
, wherecol
isNULL
, evaluates toNULL
.To test for
NULL
, use the comparison conditionsIS NULL
orIS NOT NULL
. BecauseNULL
represents a lack of data, aNULL
cannot be equal or unequal to any value or to anotherNULL
. Thus, the statementselect * from employees where mgr_id = NULL
evaluates to 0, since you cannot use this comparison toNULL
. However, the statementselect * from employees where mgr_id is NULL
provides the CEO of the company, since that is the only employee without a manager. For details, see"IS NULL predicate".The
NULL
value itself can be used directly as an operand of an operator or predicate. For example, the(1 = NULL)
comparison is supported. This is the same as if you castNULL
to the appropriate data type, as follows:(1 = CAST(NULL AS INT))
. Both methods are supported and return the same results.
Because of these properties, TimesTen ignores columns, rows, or parameters containingNULL
when:
Joining tables if the join is on a column containing
NULL
.Executing aggregate functions.
In several SQL predicates, described in Chapter 5, "Search Conditions," you can explicitly test for NULL
. APIs supported by TimesTen offer ways to handle null values. For example, in an ODBC application, use the functionsSQLBindCol
,SQLBindParameter
,SQLGetData
, and SQLParamData
to handle input and output ofNULL
values.
INF and NAN
TimesTen supports the IEEE floating-point values Inf
(positive infinity),-Inf
(negative infinity), and NaN
(not a number).
Constant values
You can use constant values in places where a floating-point constant is allowed. The following constants are supported:
BINARY_FLOAT_INFINITY
-BINARY_FLOAT_INFINITY
BINARY_DOUBLE_INFINITY
-BINARY_DOUBLE_INFINITY
BINARY_FLOAT_NAN
BINARY_DOUBLE_NAN
In the following example, a table is created with a column of type BINARY_FLOAT
and a column of typeTT_INTEGER
.BINARY_FLOAT_INFINITY
and BINARY_FLOAT_NAN
are inserted into the column of typeBINARY_FLOAT
.
Command> CREATE TABLE bfdemo (id BINARY_FLOAT, Ii2 TT_INTEGER);Command> INSERT INTO bfdemo VALUES (BINARY_FLOAT_INFINITY, 50);1 row inserted.Command> INSERT INTO bfdemo VALUES (BINARY_FLOAT_NAN, 100);1 row inserted.Command> SELECT * FROM bfdemo;< INF, 50 >< NAN, 100 >2 rows found.
Primary key values
Inf
, -Inf
, and NaN
are acceptable values in columns defined with a primary key. This is different fromNULL
, which is not allowed in columns defined with a primary key.
You can only insert Inf
, -Inf
, and NaN
values intoBINARY_FLOAT
and BINARY_DOUBLE
columns.
Selecting Inf and NaN (floating-point conditions)
Floating-point conditions determine whether an expression is infinite or is the undefined result of an operation (NaN
, meaning not a number).
Consider the following syntax:
<span class="italic">Expression</span> IS [NOT] {NAN|INFINITE}
Expression
must either resolve to a numeric data type or to a data type that can be implicitly converted to a numeric data type.
The following table describes the floating-point conditions.
IS [NOT] NAN
Returns TRUE
if Expression
is the valueNaN
when NOT
is not specified. Returns TRUE
ifExpression
is not the value NaN
when NOT
is specified.SELECT * FROM bfdemo WHERE id ISNOT NAN;ID, ID2< INF, 50 >1 row found.
IS [NOT] INFINITE
Returns TRUE
if Expression
is the value+Inf
or -Inf
when NOT
is not specified. ReturnsTRUE
if Expression
is neither+Inf
nor -Inf
when NOT
is specified.SELECT * FROM bfdemo WHERE id ISNOT INFINITE;ID, ID2< NAN, 100 >1 row found.
Note:
The constant keywords represent specificBINARY_FLOAT
and BINARY_DOUBLE
values. The comparison keywords correspond to properties of a value and are not specific to any type, although they can only evaluate toTRUE
forBINARY_FLOAT
or BINARY_DOUBLE
types or types that can be converted toBINARY_FLOAT
or BINARY_DOUBLE
.The following rules apply to comparisons with Inf
and NaN
:
Comparison between
Inf
(or-Inf
) and a finite value are as expected. For example, 5 >-Inf
.(Inf = Inf)
and(Inf > -Inf)
both evaluate toTRUE
.(NaN = NaN)
evaluates toTRUE
.
In reference to collating sequences:
-Inf
sorts lower than any other value.Inf
sorts lower thanNaN
andNULL
and higher than any other value.NaN
sorts higher thanInf
.NULL
sorts higher thanNaN
.NULL
is always the largest value in any collating sequence.
Expressions involving Inf and NaN
Expressions containing floating-point values may generate
Inf
,-Inf
, orNaN
. This can occur either because the expression generated overflow or exceptional conditions or because one or more of the values in the expression wasInf
,-Inf
, orNaN
.Inf
andNaN
are generated in overflow or division-by-zero conditions.Inf
,-Inf
, andNaN
values are not ignored in aggregate functions.NULL
values are. If you want to excludeInf
andNaN
from aggregates, or from anySELECT
result, use both theIS NOT NAN
andIS NOT INFINITE
predicates.
Overflow and truncation
Some operations can result in data overflow or truncation. Overflow results in an error and can generateInf
. Truncation results in loss of least significant data.
Exact values are truncated only when they are stored in the database by an INSERT
orUPDATE
statement, and if the target column has smaller scale than the value. TimesTen returns a warning when such truncation occurs. If the value does not fit because of overflow, TimesTen returns the special value Inf
and does not insert the specified value.
TimesTen may truncate approximate values during computations, when values are inserted into the database, or when database values are updated. TimesTen returns an error only uponINSERT
or UPDATE
. When overflow with approximate values occurs, TimesTen returns the special valueInf
.
There are several circumstances that can cause overflow:
During arithmetic operations, overflow can occur when multiplication results in a number larger than the maximum value allowed in its type. Arithmetic operations are defined inChapter 3, "Expressions."
When aggregate functions are used, overflow can occur when the sum of several numbers exceeds the maximum allowable value of the result type. Aggregate functions are defined inChapter 3, "Expressions."
During type conversion, overflow can also occur when, for example, a
TT_INTEGER
value is converted to aTT_SMALLINT
value.
Truncation can cause an error or warning for alphanumeric or numeric data types:
For character data, an error occurs if a string is truncated because it is too long for its target type. For
NCHAR
andNVARCHAR2
types, truncation always occurs on Unicode character boundaries. In theNCHAR
data types, a single-byte value (half a Unicode character) has no meaning and is not possible.For numeric data, a warning occurs when any trailing non-zero digit is dropped from the fractional part of a numeric value.
Underflow
When an approximate numeric value is too close to zero to be represented by the hardware, TimesTen underflows to zero and returns a truncation warning.
Replication limits
TimesTen places the following limits on the size of data types in a database that is being replicated:
VARCHAR2
andVARBINARY
columns cannot exceed four megabytes. For character-length semantics, the limit is four megabytes. The database character set determines how many characters can be represented by four megabytes. The minimum number of characters is 1,000,000/ 4 = 250,000 characters.NVARCHAR2
columns cannot exceed 500,000 characters (four megabytes).
TimesTen type mode (backward compatibility)
TimesTen supports a data type backward compatibility mode called TimesTen type mode. This is specified using the data store creation attributeTypeMode
, where TypeMode=1
indicates TimesTen mode. Type mode determines the default data type. For example,DATE
in TimesTen type mode defaults to TT_DATE
; DATE
in Oracle type mode defaults toORA_DATE
.
For more information on type modes, see "TypeMode" in Oracle TimesTen In-Memory Database Reference. For information on data type usage in TimesTen type mode, refer toOracle TimesTen In-Memory Database API and SQL Reference Guide, Release 6.0.3.
Data types supported in TimesTen type mode
Table 1-9 Data types supported in TimesTen type mode
BIGINT
A signed eight-byte integer in the range -9,223,372,036,854,775,808 (-263) to 9,223,372,036,854,775,807 (263-1).
Alternatively, specify TT_BIGINT
.
BINARY(
n
)
Fixed-length binary value of n
bytes. Legal values forn
range from 1 to 8300.
BINARY
data is padded to the maximum column size with trailing zeroes.
BINARY_DOUBLE
A 64-bit floating-point number. BINARY_DOUBLE
is a double-precision native floating point number. Supports+Inf
, -Inf
, and NaN
values.BINARY_DOUBLE
is an approximate numeric value consisting of an exponent and mantissa. You can use exponential or E-notation.BINARY_DOUBLE
has binary precision 53.
Minimum positive finite value: 2.22507485850720E-308
Maximum positive finite value: 1.79769313486231E+308
Alternatively, specify DOUBLE [PRECISION]
or FLOAT[(53)]
.
BINARY_FLOAT
A 32-bit floating-point number. BINARY_FLOAT
is a single-precision native floating-point type. Supports+Inf
, -Inf
, and NaN
values.BINARY_FLOAT
is an approximate numeric value consisting of an exponent and mantissa. You can use exponential or E-notation.BINARY_FLOAT
has binary precision 24.
Minimum positive finite value: 1.17549E-38F
Maximum positive finite value: 3.40282E+38F
Alternatively, specify REAL
or FLOAT(24)
.
CHAR[ACTER][(
n
[BYTE|CHAR])]
Fixed-length character string of length n
bytes or characters. Default is one byte.
BYTE
indicates that the column has byte-length semantics. Legal values forn
bytes range from 1 to 8300.
CHAR
indicates that the column has character-length semantics. The minimumCHAR
length is one character. The maximum CHAR
length depends on how many characters fit in 8300 bytes. This is determined by the database character set in use. For character setAL32UTF8
, up to four bytes per character may be needed, so theCHAR
length limit ranges from 2075 to 8300 depending on the character set.
A zero-length string is a valid non-NULL value. The string value "" is an empty, zero-length string, but not a NULL value. However, in PL/SQL, a zero-length string is always considered to beNULL
. Therefore, when you use PL/SQL, any empty string parameter in SQL is converted toNULL
by PL/SQL before the value is passed to the TimesTen database.
CHAR
data is padded to the maximum column size with trailing blanks. Blank-padded comparison semantics are used. For information on blank-padded and nonpadded semantics, see"Blank-padded and nonpadded comparison semantics".
Alternatively, specify TT_CHAR[(
n
[BYTE|CHAR])]
.
DATE
Stores date information: century, year, month, and day. The format is YYYY-MM-DD
, whereMM
is expressed as an integer. For example: 2006-10-28.
Storage size is four bytes.
Valid dates are between 1753-01-01 (January 1,1753) and 9999-12-31 (December 31, 9999).
Alternatively, specify TT_DATE
.
DEC[IMAL][(
p
[,
s
])]
or
NUMERIC[(
p
[,
s
])]
An exact numeric value with a fixed maximum precision (total number of digits) and scale (number of digits to the right of the decimal point). The value of precisionp
must be between 1 and 40. The value of scales
must be between 0 and p
. The default precision is 40 and the default scale is 0.
INTERVAL [+/-]
IntervalQualifier
TimesTen partially supports interval types, expressed with INTERVAL
and anIntervalQualifier
. An IntervalQualifier
can specify only a single field type with no precision. The default leading precision is eight digits for all interval types. The single field type can be one of:YEAR
, MONTH
,DAY
, HOUR
, MINUTE
, or SECOND
. Currently, interval types can be specified only with a constant.
NCHAR[(
n
)]
Fixed-length string of n
two-byte Unicode characters.
The number of bytes required is 2*n
wheren
is the specified number of characters.NCHAR
character limits are half the byte limits, so the maximum size is 4150. Default and minimum bytes of storage is 2n
(2).
A zero-length string is a valid non-NULL value. The string value "" is an empty, zero-length string, but not a NULL value. However, in PL/SQL, a zero-length string is always considered to beNULL
. Therefore, when you use PL/SQL, any empty string parameter in SQL is converted toNULL
by PL/SQL before the value is passed to the TimesTen database.
NCHAR
data is padded to the maximum column size with U+0020 SPACE
. Blank-padded comparison semantics are used. For information on blank-padded and nonpadded semantics, see"Blank-padded and nonpadded comparison semantics".
Alternatively, specify TT_NCHAR[(
n
)]
.
NATIONAL CHARACTER
and NATIONAL CHAR
are synonyms forNCHAR
.
SMALLINT
A native signed 16-bit integer in the range -32,768 (-215) to 32,767 (215-1).
Alternatively, specify TT_SMALLINT
.
TIME
A time of day between 00:00:00 (midnight) and 23:59:59 (11:59:59 pm), inclusive. The format is:HH:MI:SS
. Storage size is eight bytes.
TIMESTAMP
A date and time between 1753-01-01 00:00:00 (midnight on January 1, 1753) and 9999-12-31 23:59:59 pm (11:59:59 pm on December 31, 9999), inclusive. Any values for the fraction not specified in full microseconds result in a "Data Truncated
" error. The format is YYYY-MM-DD HH:MI:SS [.FFFFFFFFF]
.
Storage size is eight bytes.
Alternatively, specify TT_TIMESTAMP
or [TT_]TIMESTAMP(6)
.
TINYINT
Unsigned integer ranging from 0 to 255 (28-1).
Since TINYINT
is unsigned, the negation of a TINYINT
isSMALLINT
.
Alternatively, specify TT_TINYINT
.
INT[EGER]
A signed integer in the range -2,147,483,648 (-231) to 2,147,483,647 (231-1).
Alternatively, specify TT_INTEGER
.
NVARCHAR(
n
)
Variable-length string of n
two-byte Unicode characters.
The number of bytes required is 2*n
wheren
is the specified number of characters.NVARCHAR
character limits are half the byte limits so the maximum size is 2,097,152 (221). You must specifyn
.
A zero-length string is a valid non-NULL value. The string value "" is an empty, zero-length string, but not a NULL value. However, in PL/SQL, a zero-length string is always considered to beNULL
. Therefore, when you use PL/SQL, any empty string parameter in SQL is converted toNULL
by PL/SQL before the value is passed to the TimesTen database.
Blank-padded comparison semantics are used. For information on blank-padded and nonpadded semantics, see"Blank-padded and nonpadded comparison semantics".
Alternatively, specify TT_NVARCHAR(
n
)
.
NATIONAL CHARACTER VARYING
, NATIONAL CHAR VARYING
, andNCHAR
VARYING
are synonyms for NVARCHAR
.
VARCHAR(
n
[BYTE|CHAR])
Variable-length character string having maximum length n
bytes or characters. You must specifyn
.
BYTE
indicates that the column has byte-length semantics. Legal values forn
bytes range from 1 to 4194304 (222).
CHAR
indicates that the column has character-length semantics.
A zero-length string is a valid non-NULL value. The string value "" is an empty, zero-length string, but not a NULL value. However, in PL/SQL, a zero-length string is always considered to beNULL
. Therefore, when you use PL/SQL, any empty string parameter in SQL is converted toNULL
by PL/SQL before the value is passed to the TimesTen database.
Blank-padded comparison semantics are used. For information on blank-padded and nonpadded semantics, see"Blank-padded and nonpadded comparison semantics".
Alternatively, specify TT_VARCHAR(
n
[BYTE|CHAR])
.
VARBINARY
(
n
)
Variable-length binary value having maximum length n
bytes. Legal values forn
range from 1 to 4194304 (222).
Oracle data types supported in TimesTen type mode
Table 1-10 Oracle data types supported in TimesTen type mode
NUMBER[(
p
[,
s
])]
Number having precision and scale. The precision value ranges from 1 to 38 decimal. The scale value ranges from -84 to 127. Both precision and scale are optional.
If you do not specify a precision or a scale, then maximum precision of 38 and flexible scale are assumed.
NUMBER
supports scale > precision and negative scale.
NUMBER
stores zero as well as positive and negative fixed numbers with absolute values from 1.0 x 10-130 up to but not including 1.0 x 10126. If you specify an arithmetic expression whose value has an absolute value greater than or equal to 1.0 x 10126, then TimesTen returns an error.
In TimesTen type mode, the NUMBER
data type stores 10E-89 as its smallest (closest to zero) value.
ORA_CHAR[(
n
[BYTE|CHAR])]
Fixed-length character string of length n
bytes or characters. Default is one byte.
BYTE
indicates that the column has byte-length semantics. Legal values forn
bytes range from 1 to 8300.
CHAR
indicates that the column has character-length semantics. The minimumCHAR
length is one character. The maximum CHAR
length depends on how many characters fit in 8300 bytes. This is determined by the database character set in use. For character setAL32UTF8
, up to four bytes per character may be needed, so theCHAR
length limit ranges from 2075 to 8300 depending on the character set.
A zero-length string is a valid non-NULL value. The string value "" is an empty, zero-length string, but not a NULL value. However, in PL/SQL, a zero-length string is always considered to beNULL
. Therefore, when you use PL/SQL, any empty string parameter in SQL is converted toNULL
by PL/SQL before the value is passed to the TimesTen database.
ORA_CHAR
data is padded to the maximum column size with trailing blanks. Blank-padded comparison semantics are used. For information on blank-padded and nonpadded semantics, see"Blank-padded and nonpadded comparison semantics".
ORA_DATE
Stores date and time information: century, year, month, date, hour, minute, and second. Format isYYYY-MM-DD HHMMSS
.
Valid date range is from January 1, 4712 BC to December 31, 9999 AD.
The storage size is seven bytes. There are no fractional seconds.
ORA_NCHAR[(
n
)]
Fixed-length string of length n
two-byte Unicode characters.
The number of bytes required is 2*n
wheren
is the specified number of characters.NCHAR
character limits are half the byte limits so the maximum size is 4150. Default and minimum bytes of storage is 2n
(2).
A zero-length string is a valid non-NULL value. The string value "" is an empty, zero-length string, but not a NULL value. However, in PL/SQL, a zero-length string is always considered to beNULL
. Therefore, when you use PL/SQL, any empty string parameter in SQL is converted toNULL
by PL/SQL before the value is passed to the TimesTen database.
ORA_NCHAR
data is padded to the maximum column size with U+0020 SPACE
. Blank-padded comparison semantics are used. For information on blank-padded and nonpadded semantics, see"Blank-padded and nonpadded comparison semantics".
ORA_NVARCHAR2
(
n
)
Variable-length string of n
two-byte Unicode characters.
The number of bytes required is 2*n
wheren
is the specified number of characters.ORA_NVARCHAR2
character limits are half the byte limits so the maximum size is 2,097,152 (221). You must specifyn
.
A zero-length string is a valid non-NULL value. The string value "" is an empty, zero-length string, but not a NULL value. However, in PL/SQL, a zero-length string is always considered to beNULL
. Therefore, when you use PL/SQL, any empty string parameter in SQL is converted toNULL
by PL/SQL before the value is passed to the TimesTen database.
Nonpadded comparison semantics are used.
For information on blank-padded and nonpadded semantics, see"Blank-padded and nonpadded comparison semantics".
ORA_VARCHAR2(
n
[BYTE|CHAR])
Variable-length character string having maximum length n
bytes or characters.
BYTE
indicates that the column has byte-length semantics. Legal values forn
bytes range from 1 to 4194304 (222). You must specifyn
.
CHAR
indicates that the column has character-length semantics.
A zero-length string is a valid non-NULL value. The string value "" is an empty, zero-length string, but not a NULL value. However, in PL/SQL, a zero-length string is always considered to beNULL
. Therefore, when you use PL/SQL, any empty string parameter in SQL is converted toNULL
by PL/SQL before the value is passed to the TimesTen database.
Nonpadded comparison semantics are used. For information on blank-padded and nonpadded semantics, see"Blank-padded and nonpadded comparison semantics".
ORA_TIMESTAMP
[(
fractional_seconds_precision
)]
Stores year, month, and day values of the date data type plus hour, minute, and second values of time.Fractional_seconds_precision
is the number of digits in the fractional part of the seconds field. Valid date range is from January 1, 4712 BC to December 31, 9999 AD.
The fractional seconds precision range is 0 to 9. The default is 6. Format is:
YYYY-MM-DD HH:MI:SS [.FFFFFFFFF]
Storage size is 12 bytes.
转自:http://blog.csdn.net/is2120/article/details/7818101
- Oracle 数据类型
- Oracle 数据类型
- Oracle数据类型
- Oracle 数据类型
- Oracle 数据类型
- Oracle 数据类型
- Oracle 数据类型
- oracle数据类型
- Oracle数据类型
- Oracle 数据类型
- Oracle数据类型
- Oracle 数据类型
- oracle 数据类型
- Oracle数据类型
- ORACLE 数据类型
- Oracle 数据类型
- Oracle数据类型
- ORACLE数据类型
- ImageLazyLoad JQ说明
- struts2 jsp <s:property value="path" /> path为中文的时候乱码
- 数组求和
- Qt Creator配置msvc的编译器
- 安卓多线程编程系列2:异步任务的使用之使用异步任务带有进度的横向滚动条下载网络图片
- oracle数据类型
- 程序员的机器学习入门笔记(一):基本概念介绍
- 数据库多张表链接操作
- char*和char[ ]的区别
- java线程安全
- Android Studio 小知识——Error:Execution failed for task : app:dexDebug. com.android.ide
- 学习一段python简单备份程序
- 数据结构之“Ordered List and Sorted List”(三)
- 【文章推荐】Android MVP模式 简单易懂的介绍方式