Home » RDBMS Server » Server Administration » A date field in a primary key
A date field in a primary key [message #373316] Wed, 11 April 2001 07:45 Go to next message
valcindor@yahoo.com
Messages: 4
Registered: April 2001
Location: France
Junior Member
I need to include a field date in the primary of a table. But when I try to insert new record with the same date but different time of the day, I get an
error message "Unique constraint violated".

How can I handle this ?
Re: A date field in a primary key [message #373328 is a reply to message #373316] Wed, 11 April 2001 12:36 Go to previous message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
Oracle will only see it as being unique if the date&time is identical (down to to seconds which is the highest precision supported). Examine your existing data...

select to_char(date_col, 'dd-mon-yyyy hh24:mi:ss')...

if you are using date pictures, ensure that you are using hh24. If you are using hh, then you need to use am/pm too.0 Also use mi for minutes not mm (months)
Previous Topic: SQLLOADER QUESTION
Next Topic: loop & user input
Goto Forum:
  


Current Time: Sat Jun 01 20:45:14 CDT 2024