Reputation: 27
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)
);
Upvotes: 0
Views: 1084
Reputation: 521419
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.
Upvotes: 1