user182944
user182944

Reputation: 8067

Oracle TIMESTAMP error:datetime/interval precision is out of range

I created a table with TIMESTAMP(9) in Oracle 10g. Then i tried to insert CURRENT_TIMESTAMP value in that column but unfortunately got the error message: value too large for column: (actual: 35, maximum: 25)

Then i tried this query:

select length(current_timestamp) from dual;

and the count was 35.

But Oracle does not allow me to define TIMESTAMP(35) while creating the table structure.

In such a case, how to define the Timestamp column while creating the table and how to insert the Current Timestamp value in the Timestamp column?

Upvotes: 0

Views: 11852

Answers (1)

Justin Cave
Justin Cave

Reputation: 231661

Can you post your table definition and the exact SQL statement you are using to insert the CURRENT_TIMESTAMP? If you're actually inserting a TIMESTAMP you shouldn't get that error

SQL> create table foo ( col1 timestamp(9) );

Table created.

SQL> insert into foo values( current_timestamp );

1 row created.

length(current_timestamp) is implicitly converting the timestamp to a string and determining the length of that string. The error you are getting seems to imply that there is a similar conversion happening when you are trying to insert the data into the table.

Upvotes: 2

Related Questions