The article below was written By Sanskruti
A datatype is a classification of a particular type of information or data. Each value manipulated by Oracle has a datatype. The datatype of a value associates a fixed set of properties with the value. These properties cause Oracle to treat values of one datatype differently from values of another.
Numeric
The NUMBER data type is used to store zero, negative, positive, fixed, and floating point numbers with up to 38 digits of precision. Numbers range between 1.0x10 -130 and 1.0x10 126.
Numbers can be defined in following ways:
- NUMBER(p,s)
where p is the precision up to 38 digits and s is the scale (number of digits to the right of the decimal point). The scale can range between -84 to 127.
- NUMBER (p)
This is a fixed-point number with a scale of zero and a precision of p.
- FLOAT[(p)]
Oracle supports the ANSI data type FLOAT. Therefore, specifying a floating-point number you can use FLOAT data type instead of NUMBER data type.
p is the binary precision that can range from 1 to 126. If p is not specified the default value is binary 126. To convert from binary to decimal precision, multiply p by 0.30103. To convert from decimal to binary precision, multiply the decimal precision by 3.32193. 126 digits of binary precision is roughly equivalent to 38 digits of decimal precision.
Date
Instead of storing date and time information in a character or numeric format, a separate data type was created. For each DATE data type, the following information is stored:
- Century
- Year
- Month
- Day
- Hour
- Minute
- Second
You can easily retrieve the current date and time by using the function SYSDATE. Date arithmetic is possible using number constants or other dates. Only addition and subtraction are supported. For example, SYSDATE + 7 will return one week from today. Every database system has a default date format that is defined by the initialization parameter NLS_DATE_FORMAT. This parameter is usually set to DD-MON-YY, where DD is the day of the month (the first day of the month is 01), MON is the abbreviated month name, and YY is a two-digit year designation. If you do not specify a time, the default time is 12:00:00 a.m. If only the time component is captured, the default date will be the first day of the current month.
- TIMESTAMP[(fractional_seconds_precision)]
The TIMESTAMP data type is an extension of the DATE data type. For each TIMESTAMP value, Oracle stores the following information: year, month, day, hour, minute, second and fraction of second. fractional_seconds_precision optionally specifies the number of digits in the fractional part of second and can be a number in the range 0 to 9. The default is 6. The TIMESTAMP data type is available in Oracle 9i Release 1 (9.0.1) or later.
Character
- The CHAR data type is used where fixed-length fields are necessary. Any length up to 255 characters can be specified. The default length is 1. When data is entered, any space left over will be filled with blanks. All alpha-numeric characters are allowed.
- The VARCHAR2 is used for variable-length fields. A length component must be supplied when you use this data type. The maximum length is 2000 characters. All alpha-numeric characters are allowed.
- The LONG data type is used to store large amounts of variable-length text. Any length up to 2 GB can be specified. Be aware that there are some restrictions to using this data type, such as:
- Only one column per table can be defined as LONG.
- A LONG column cannot be indexed.
- A LONG column cannot be passed as an argument to a procedure.
- A function cannot be used to return a LONG column.
- A LONG column cannot be used in where, order by, group by, or connect by clauses.
- NCHAR[(n)]
Fixed-length character data of length n characters or bytes, depending on the national character set. The maximum length is determined by the number of bytes required to store each character, with an upper limit of 2000 bytes. The default value is 1.
- NVARCHAR2(n)
Variable-length character data having maximum length n characters or bytes, depending on the national character set. The maximum length is determined by the number of bytes required to store each character, with an upper limit of 4000 bytes. You must specify the maximum length for NVARCHAR2 columns.
Binary
Two data types, RAW and LONGRAW, are available for storing binary type data such as digitized sound and images. These data types take on similar characteristics as the VARCHAR2 and LONG data types already mentioned. Use the RAW data type to store binary data up to 2000 characters and use the LONGRAW data type to store binary data up to 2 GB. Oracle only stores and retrieves binary data; no string manipulations are allowed. Data is retrieved as hexadecimal character values.
Others
BLOB, CLOB, NCLOB and BFILE
The built-in LOB data types BLOB, CLOB and NCLOB (stored internally), and BFILE (stored externally), can store large and unstructured data such as text, images and spatial data up to 4 gigabytes in size.
BLOB The BLOB data type stores binary large objects. BLOB can store up to 4 gigabytes of binary data.
CLOB
The CBLOB data type stores character large objects. CLOB can store up to 4 gigabytes of character data.
NCLOB
The NCBLOB data type stores character large objects in multibyte national character set. NCLOB can store up to 4 gigabytes of character data.
BFILE
The BFILE data type enables access to binary file LOBs that are stored in file systems outside the Oracle database. A BFILE column stores a locator, which serves as a pointer to a binary file on the server's file system. The maximum file size supported is 4 gigabytes.
ROWID and UROWID
ROWID
The ROWID data type is used to store physical address of each row in the database. This data type is primarily for values returned by the ROWID pseudocolumn.
UROWID[(n)]
The UROWID data type is used to store the logical addresses of index-organized and foreign tables.
n is the size of a UROWID column. The range of n is 1 to 4000. The default value is 4000.
This data type is available in Oracle 9i Release 1 (9.0.1) or later.
<!----><!---->
分享到:
相关推荐
http://www.toadworld.com/platforms/oracle/w/wiki/2004.datatypes-processing-an-anydata-value STATIC FUNCTION ConvertObject(obj IN "<ADT_1>") return AnyData, STATIC FUNCTION ConvertObject(obj IN ...
Get to grips with how to use Oracle Spatial's standards compliant geometry data types to develop cross-vendor database solutions to common problems ☆ 出版信息:☆ [作者信息] Simon Greener , Siva ...
applications and use JDBC, the “Data types and JDBC” section will be particularly useful. Oracle and PostgreSQL both conform to standard SQL. However, they contain several extensions and ...
Using a Subquery in the FROM Clause 4-10 Scalar Subquery Expressions 4-11 Scalar Subqueries: Examples 4-12 Correlated Subqueries 4-14 Using Correlated Subqueries 4-16 Using the EXISTS Operator 4-18 ...
The inspiration for the material contained in this book comes from my experiences ...structures in the database such as tables, indexes, and datatypes, covering techniques for making optimal use of them.
Security in an oracle System Chapter 1 Oracle and Security What’s It All About? The Oracle Security Model Procedures, Policies, and Plans If I Had a Hammer... Chapter 2 Oracle System Files ...
public static Oracle.DataAccess.Types.OracleArray ConvertToListArray(List<MyType> myList) { OracleConnection conn = new OracleConnection("your_connection_string"); OracleDataAdapter adapter = new ...
The authors share their experience in the form of tutorials on designing and implementing all types of Oracle GoldenGate environments. You'll learn methods for tuning Oracle GoldenGate performance. ...
Explore datatypes, conditional and sequential control statements, loops, exception handling, security features, globalization and localization issues, and the PL/SQL architecture Understand and use ...
only dataset" error in Android is fixed MySQL data provider Bug with setting the data type of the parameter to BOOLEAN for all TINYINT system data types in the functions is fixed PostgreSQL data ...
1 Introduction and Upgrading 2 OCI Programming Basics 3 Datatypes 4 Using SQL Statements in OCI 5 Binding and Defining
It contains the JDBC driver classes except classes for NLS support in Oracle Object and Collection types. Download ojdbc6_g.jar (5,382,573 bytes) - Same as ojdbc6.jar except compiled with "javac -g" ...
Let Expert Indexing in Oracle Database 12c be your guide to deep mastery of the most fundamental performance optimization structure in Oracle Database. Explains how indexes help performance, and ...
同样,Oracle Database In-Memory Option也在不断完善,加入了如并行复制、国家语言支持、Oracle Data Types支持等多种特性,以适应更广泛的应用场景。 综上所述,Oracle的分布式关系型内存数据库解决方案通过提供...
using (OracleConnection conn = new OracleConnection("Data Source=mydata;User Id=store;Password=store;")) { conn.Open(); // 开始事务 OracleTransaction trans = conn.BeginTransaction(Isolation...
Bug with setting the data type of the parameter to BOOLEAN for all TINYINT system data types in the functions is fixed PostgreSQL data provider Bug with reading and writing of the floating point ...
Filled with detailed examples and expert strategies from an Oracle ACE, Oracle Database 12c PL/SQL Programming explains how to retrieve and process data, write PL/SQL statements, execute effective ...
cs.registerOutParameter(3, OracleTypes.CURSOR); cs.execute(); ResultSet rs = (ResultSet) cs.getObject(3); while (rs.next()) { // 处理结果集 } rs.close(); cs.close(); conn.close(); } } ```...