• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
exactly. 4 digits, of which two are decimals.
 
Evil is afoot. But this tiny ad is just an ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic