• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to insert 1.5 into a sql colunm on Number(2,2)

 
Dave Trower
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to do the following:


Now the sixth field is NUMBER(2,2)
I am getting the error "ORA-01438: value larger than specified precision allowed for this column"
How can I do this?
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by listing the column names in your sql insert query. Who knowns what you are inserting in which column?
 
Dave Trower
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I do a desribe on the table:
SQL> desc timesheetdata
Name Null? Type
----------------------------------------- -------- ----------------------------
TIMESHEET_ID NOT NULL NUMBER(10)
USERID VARCHAR2(20)
TIME_DATE DATE
CAMIT_ID VARCHAR2(20)
ACTIVITY VARCHAR2(20)
HOURS NUMBER(2,2)
COMMENTS VARCHAR2(256)

I know that the problem is with the sixth field.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But doesn't that column only allow numbers of the form ".NN"? How would you expect 1.50 to fit into that?
 
Dave Trower
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Paul disovered the problem.
So if I want to able to store fields like 10.25, would I need the Oracle column to be number(4,2)?
This is suppose to represent the number of hours worked per day (which cannot be higher than 24) and we want two decimal places.
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
exactly. 4 digits, of which two are decimals.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic