0% found this document useful (0 votes)
2 views

08. Oracle Database -Data Types

The document outlines various data types used in programming, categorized into Numeric, Character, and Date/Time types. It provides detailed explanations, lengths, and examples for each data type, including NUMBER, FLOAT, INTEGER, CHAR, VARCHAR2, DATE, and TIMESTAMP. Additionally, it highlights differences between VARCHAR and VARCHAR2, emphasizing the recommended usage of VARCHAR2.

Uploaded by

omprakashmunde33
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

08. Oracle Database -Data Types

The document outlines various data types used in programming, categorized into Numeric, Character, and Date/Time types. It provides detailed explanations, lengths, and examples for each data type, including NUMBER, FLOAT, INTEGER, CHAR, VARCHAR2, DATE, and TIMESTAMP. Additionally, it highlights differences between VARCHAR and VARCHAR2, emphasizing the recommended usage of VARCHAR2.

Uploaded by

omprakashmunde33
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

CREDENCE IT PROFESSIONAL

TRAINING INSTITUTE, PUNE

Contents
1) Numeric Data Types ............................................................................................................................ 1
i. NUMBER ............................................................................................................................................. 1
ii. FLOAT................................................................................................................................................... 1
iii. INTEGER .............................................................................................................................................. 2
2) Character Data Types .......................................................................................................................... 2
i. CHAR .................................................................................................................................................... 2
ii. VARCHAR2 ......................................................................................................................................... 3
3) Date/Time Data Types ........................................................................................................................ 4
i. DATE ..................................................................................................................................................... 4
ii. TIMESTAMP ....................................................................................................................................... 4

Email: [email protected] Website: https://www.credence.in

Contacts: +91 8237916162, +91 7391053250, +91 9579064658, +91 9091929355


CREDENCE IT PROFESSIONAL
TRAINING INSTITUTE, PUNE

1) Numeric Data Types


i. NUMBER
• Explanation: A flexible data type for integers or decimals with user-defined
precision and scale.

• Length: Up to 38 digits.

• Examples:
I. NUMBER – Basic number with maximum precision.
II. NUMBER(10) – Number with 10 digits of precision.
III. NUMBER(10, 2) – Number with 10 digits total, 2 after the decimal.
IV. NUMBER(5, 0) – Number with 3 digits and no decimals.

ii. FLOAT
• Explanation: Stores numeric data with floating-point precision.

• Length: Up to 38 digits.

• Examples:

I. FLOAT – Basic floating-point number.

II. FLOAT(5) – Floating-point number with precision of 5 digits.

III. FLOAT(10) – Floating-point number with precision of 10 digits.

Email: [email protected] Website: https://www.credence.in

Contacts: +91 8237916162, +91 7391053250, +91 9579064658, +91 9091929355


CREDENCE IT PROFESSIONAL
TRAINING INSTITUTE, PUNE

iii. INTEGER
• Explanation: A whole number with no fractional or decimal part, INTEGER is a
subtype of NUMBER with precision 0 (no decimals).

• Length: Up to 38 digits.

• Examples:

I. INTEGER, INT: Integer with up to 38 digits.

II. INTEGER(5) – Integer with up to 5 digits.

2) Character Data Types


i. CHAR
• Explanation:

o Always stores the specified number of characters.

o If the input is shorter than the specified length, it pads the remaining
space with blanks (spaces).

• Use: Codes like country abbreviations or phone number or Zip code.

• Length: 1 to 2000 characters.

• Examples:

o CHAR(2000) – Fixed-length character field of 2000 characters

o CHAR(5) – Fixed-length character field of 5 characters

Email: [email protected] Website: https://www.credence.in

Contacts: +91 8237916162, +91 7391053250, +91 9579064658, +91 9091929355


CREDENCE IT PROFESSIONAL
TRAINING INSTITUTE, PUNE

ii. VARCHAR2
• Explanation:

o Stores variable-length character strings.

o Uses only as much space as needed for the data.

o Does not pad extra spaces, saves storage space.

• Use: Names, addresses, descriptions.

• Length: 1 to 2000 characters.

• Examples:

o VARCHAR2(2000) – Variable-length character field up to 2000 characters

o VARCHAR2(5) – Variable-length character field up to 5 characters

Aspect VARCHAR VARCHAR2


Stores variable-length Stores variable-length
Purpose
character data. character data.

May behave differently in


Stable; no future changes
Future Changes the future (reserved for
planned.
changes).

Not recommended for Recommended for use in


Recommendation
use in applications. applications.

Email: [email protected] Website: https://www.credence.in

Contacts: +91 8237916162, +91 7391053250, +91 9579064658, +91 9091929355


CREDENCE IT PROFESSIONAL
TRAINING INSTITUTE, PUNE

Rarely used due to Widely used and


Differences in Use
uncertainty. supported.

3) Date/Time Data Types


i. DATE
• Explanation: Stores date and time.

• Examples:

o DATE – Standard date without time zone.

o 2024-12-25 10:00:00.

ii. TIMESTAMP
• Explanation: Date and time with fractional seconds.

• Examples: 2024-12-25 10:00:00.123.

o TIMESTAMP – Basic timestamp without constraints.

o TIMESTAMP(3) – Timestamp with milliseconds precision.

o TIMESTAMP(6) – High precision timestamp (microseconds).

o TIMESTAMP(9) – Nanosecond precision.

Email: [email protected] Website: https://www.credence.in

Contacts: +91 8237916162, +91 7391053250, +91 9579064658, +91 9091929355

You might also like