What Is Number Data Type in Teradata?


Heather Bennett

The Number data type in Teradata is used to store numeric values with precision and scale. It allows for the storage of both whole numbers and decimal numbers, providing a flexible solution for handling numerical data in Teradata databases.

Precision and Scale

When defining a column with the Number data type, you need to specify the precision and scale. The precision represents the total number of digits that can be stored in the column, while the scale represents the number of digits that can be stored after the decimal point.

To illustrate this, consider a Number(5, 2) column. This means that it can store up to 5 digits in total, with 2 digits after the decimal point. For example, it can store values like 123.45 or -12.34.

Example Usage

To create a table with a Number data type column in Teradata, you can use the following syntax:

CREATE TABLE ExampleTable (
    id INTEGER,
    amount NUMBER(8, 2)

In this example, we have created a table called ExampleTable with two columns: ‘id’ of INTEGER data type and ‘amount’ of NUMBER(8, 2) data type.

Inserting Data

To insert data into a Number column, you need to provide a numeric value that fits within the specified precision and scale. For instance:

INSERT INTO ExampleTable (id, amount)
VALUES (1, 1234.56);

This query inserts a row into ExampleTable with an ‘id’ of 1 and an ‘amount’ of 1234.56.

Querying Data

When querying data from a Number column, the retrieved values will retain their original precision and scale. You can perform various mathematical operations on Number data types, such as addition, subtraction, multiplication, and division.

SELECT id, amount * 2 AS doubled_amount
FROM ExampleTable;

This query retrieves the ‘id’ and ‘amount’ columns from ExampleTable and multiplies the ‘amount’ by 2, returning the result as ‘doubled_amount’.


The Number data type in Teradata is a powerful tool for storing and manipulating numeric values. It offers precision and scale control, allowing you to define columns that accommodate a wide range of numerical data. By understanding how to use this data type effectively, you can better manage your numeric data in Teradata databases.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy