Comp Sci Insert Data Into SQL Table with Number Datatype

  • Thread starter Thread starter Crystal037
  • Start date Start date
AI Thread Summary
To insert a decimal value like 1.1 into an SQL table, the number datatype must be defined correctly, such as using number(2, 1). This definition specifies that the total number of digits is 2, with 1 digit to the right of the decimal point. Proper datatype configuration is essential for accurate data representation in SQL. For further details on the number data type, refer to Oracle's documentation. Understanding these specifications ensures successful data insertion into SQL tables.
Crystal037
Messages
167
Reaction score
7
Homework Statement
I can't understand what is meant by precision and scale while declaring a variable as number datatype in SQL Oracle. I have created a table example and specified attr1 as number(1,1) datatype. According to my understanding it can take one digit before decimal and 1 digit after decimal.But if I'm trying to insert values like 1.1 it's showing value larger than specified precision allowed for this column. Can u explain if my understanding of precision is correct.
Relevant Equations
create table example(
attr1 number(1,1));
insert into example values(1.1);
Screenshot (128).png
 
Last edited by a moderator:
Physics news on Phys.org
Mark44 said:
The image is too small to be legible.
Referring image isn't necessary I've written the query in relevant equations part
 

Similar threads

Replies
17
Views
3K
Replies
5
Views
963
Replies
1
Views
2K
Replies
8
Views
944
Replies
10
Views
2K
Replies
8
Views
2K
Back
Top