Home>Question Details



Duke -- Thanks for the question regarding "Can we change default TIMESTAMP (6) precision per session or database?", version 10.0.2

Submitted on 24-Mar-2008 12:13 Central time zone
Last updated 27-Mar-2008 10:31

You Asked

While trawling David Aldridge's site
http://oraclesponge.wordpress.com/2008/03/07/timestamps-old-fogeys-and-data-warehouses/

I wondered, but could not find in the documentation: Is there any way of changing the default precision of 6 for TIMESTAMP at a global or session level (instead of column at creation)?

Thanks!

and we said...

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm#i53219


the default is six, much like the default for a number is (*,*) and the default for a char is 1 and a default for a varchar2 is "not defined"..

and the defaults are the default - constantly and consistently applied. You cannot change the default value used for them, you have to manually specify what you want if the default is not appropriate.
Reviews    
3 stars changing precision   March 26, 2008 - 5am Central time zone
Reviewer: Duke Ganote from Tourist-trappy Kissimmee, Florida USA
Timestamps are cumbersome to modify:

drop table t;

Table dropped.

create table t as select systimestamp ts from dual;

Table created.

alter table t modify ts timestamp (0);
alter table t modify ts timestamp (0)
                     *
ERROR at line 1:
ORA-01439: column to be modified must be empty to change datatype


alter table t modify ts timestamp (9);
alter table t modify ts timestamp (9)
                     *
ERROR at line 1:
ORA-01439: column to be modified must be empty to change datatype


Followup   March 26, 2008 - 9am Central time zone:

just like numbers and strings - only numbers and strings (varchar2 strings) can be made larger easily (not smaller)

timestamps are a fixed width datatype, changing the size would require rewriting the ENTIRE table (unless they are all null)


4 stars   March 26, 2008 - 7pm Central time zone
Reviewer: David Aldridge from Fairfax, VA
>> ... changing the size would require rewriting the ENTIRE table (unless they are all null) 

I still wish we had the option to override the "no non-null values" check though, and just take any 
pain associated with the required changes. I suppose that the major issues would be migrated rows, 
a locked table, a potentially high i/o load, data segment compression issues, and having to deal 
with indexes.

To not be able to for the sake of one non-null value out of fifty gazillion null values is a 
frustration. I'm not saying there isn't a way round it, or that it's particularly onerous, but 
there are cases when it would be a useful option.


Followup   March 27, 2008 - 10am Central time zone:

dbms_redefinition would do that and avoid the ... migrated rows, a locked table, a potentially
high i/o load, data segment compression issues, and having to deal with
indexes. ....

issues.



All information and materials provided here are provided "as-is"; Oracle disclaims all express and implied warranties, including, the implied warranties of merchantability or fitness for a particular use. Oracle shall not be liable for any damages, including, direct, indirect, incidental, special or consequential damages for loss of profits, revenue, data or data use, incurred by you or any third party in connection with the use of this information or these materials.

About Oracle | Legal Notices and Terms of Use | Privacy Statement