Tip of the Day - Oracle & PostgreSQL for Developer & Administrator


Tip of the Day ( Monday, October 27, 2025 )

Precision and scale of Number data type in Oracle

In Oracle database, you can specify a fixed-point number using the form: NUMBER(p.s)

  • ‘p’ is the precision which indicates the maximum number of total significant decimal digits. (From the most to the least significant digit)
  • ‘s’ is the scale which indicates the number of digits from the decimal point to the least significant digit, The scale can range from -84 to 127.

Please see the image below for a better understanding.



##################################################################### 


Tip of the Day ( Sunday, October 26, 2025 )

About VARCHAR2 data type in Oracle

VARCHAR2 – Variable length character string in the database character set. VARCHAR2 only uses as much space as needed for the stored data, making it more efficient.

Syntax: VARCHAR2 (size [BYTE | CHAR])

  • size option is mandatory and defines the maximum length of the VARCHAR data type.
  • Minimum size : 1 byte or character
  • Maximum size : 4000 bytes or characters


##################################################################### 


Saturday, October 25, 2025

About CHAR datatype in Oracle

CHAR is a Fixed length character strings in the Database character set. 

  • Syntax : CHAR [(size [BYTE | CHAR])]
  • Size is optional. Default size: 1 BYTE
  • Minimum size : 1 byte, Maximum size : 2000 bytes

Example: (In a CREATE TABLE statement)

CREATE TABLE local
(
 state_code CHAR(2),   // Fixed 2 byte state code
 country_code CHAR(3), // Fixed 3 byte country code
 active CHAR           // 'Y' or 'N' - Fixed 1 byte active status. Default size
);


No comments:

Post a Comment