|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
is a less precise date format (no hour/min/sec) possible?
My app needs to store some data once per day, and only once per day... I currently have a table with a normal Date type column, and a constraint that limits inserts to one per specific day.
Is it possible to set up a less precise data type (i.e. drop the hour/min/sec information from the date)? I'd like to get rid of the constraint since I don't have full administrative privileges to the deployment database (only the testing one) and I need to rely on the kindness of strangers to run the constraint creation statement for me... Simply, I'd like to store a date as ONLY Month/Day/Year... no pesky Hours/Minutes/Seconds... Any ideas? <small edit> My testing db is Oracle 9i Release 9.2.0.1.0 My deployment db is Oracle 10g Release 10.1.0.3.0 |
|
#2
|
|||
|
|||
|
Insert trunc(SYSDATE) or whatever date variable you're using for a timestamp.
This sounds a lot more like a schema issue - you should create a DDL script to drop the constraint. The script goes along with your code and is part of the install of your code. Times and or dates are stored as an octaword - a 16 byte integer - called DATE datatypes. Not using a DATE datatype on a timestamp is a not-so-great idea. VARCHAR2 data for dates doesn't sort well unless you use 'YYYYMMDD'. I don't know your design, but chances are you will run into needing a simple way to get certain dates from the table. Every instance of using VARCHAR2 or some other datatype for dates - that I have seen - has caused more problems than it ever fixed. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > is a less precise date format (no hour/min/sec) possible? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|