'The below sql code shows the error : ORA-01727: numeric precision specifier is out of range (1 to 38)
This SQL code results in an error :
ORA-01727: numeric precision specifier is out of range (1 to 38).
What changes should be made for the code to work?
CREATE TABLE employees
(
e_id NUMBER(10) PRIMARY KEY,
f_name VARCHAR(20),
salary NUMBER(50),
dept_name VARCHAR(10)
);
Solution 1:[1]
According to the docs, the NUMBER type has a range of up to 38 significant figures:
A decimal number with up to 38 significant digits in the range of -(10^125) to +(10^125).
You may decrease the precision of your salary field:
CREATE TABLE employees (
e_id NUMBER(10) PRIMARY KEY,
f_name VARCHAR(20),
salary NUMBER(37),
dept_name VARCHAR(10)
);
For reference, the wealthiest people in the world earn on the order of 1 billion per year, so NUMBER(9) would probably be sufficient for your salary field.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tim Biegeleisen |
