oracle-databaseoracle10gora-01438

Insert query showing an error


I created a table in oracle10g using following query......

CREATE TABLE  "MOBILELOCATION" 
("EMPLOYEEID" NUMBER NOT NULL ENABLE, 
 "PRESENTDATE" VARCHAR2(30) NOT NULL ENABLE, 
  "PRESENTTIME" VARCHAR2(30) NOT NULL ENABLE, 
  "LATITUDE" NUMBER(6,10) NOT NULL ENABLE, 
 "LONGITUDE" NUMBER(6,10) NOT NULL ENABLE) 

Table was created successfully... but the problem is while iam trying to insert a row into the table it is showing the error

error ORA-01438: value larger than specified precision allowed for this column

The query i used is ,

insert into mobilelocation values(12303,'30-10-2011','09:30',16.9876,82.3426);

Where i voilated the constraints?? Please explain any one..


Solution

  • Your columns LATITUDE and LONGTITUDE are defined rather strangely - NUMBER(6,10) says 6 for precision (total number of digits) and 10 for scale (number of digits to the right of the decimal point).

    You either change them to NUMBER(*) or to NUMBER (10, 6) or NUMBER(*,4) or similar... the correct declaration is hard to guess but all mentioned would work with the sample data you provided...

    For reference see http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#i16209