Oracle - Data Types

oracle

How many numeric types does Oracle have?

Oracle only has one flexible underlying numeric type, NUMBER, but Oracle does support several aliases:

  1. INTEGER: NUMBER(38)
  2. INT: NUMBER(38)
  3. SMALLINT: NUMBER(38)
  4. DECIMAL(p,s): NUMBER(p,s)
  5. NUMERIC(p,s): NUMBER(p,s)
  6. FLOAT: NUMBER
  7. FLOAT(b): NUMBER(p)
  8. REAL: NUMBER(18)

What are the string data types supported by Oracle?

  1. VARCHAR2(size)
  2. NVARCHAR2(size)
  3. CHAR
  4. CHAR(size)
  5. NCHAR(size)
  6. RAW(size)

What is the purpose of the RAW data type?

The RAW data type represent hexadecimal characters. The contents are treated as non-character binary data type and thus are never translated by character set conversion or gateway interfaces.

What is the purpose of NCHAR and NVARCHAR2?

NCHAR and NVARCHAR2 hold string values of a defined national character set.

When does Oracle convert character sets?

Oracle automatically converts character data between the character set of the database defined when the database was created and the character set of the client defined by NLS_LANG parameter for the CHAR and VARCHAR2 data types, or the NLS_NCHAR parameter for the NCHAR and NVARCHAR2 data types.

How can we convert a string between character sets?

CONVERT(string, dest_char_set, source_char_set)

The CONVERT function can be used to convert a string between character sets if we know the source character set, and the desired destination character set.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License