Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unique Constraint on Date datatype

user5605610Apr 12 2011 — edited Apr 12 2011
Hi,

I have below table.

CREATE TABLE unique_date_check
(employee_id NUMBER ,
amount NUMBER ,
pay_date DATE DEFAULT sysdate ,
CONSTRAINT uq_pay_date UNIQUE (pay_date));


The table should accept only one amount per employee per pay_date.

I am using sysdate as pay_date. Since sysdate has also timestamp in it, the constraint is checking for uniqueness both on date and timestamp.

I need uniqueness only on the date part (i.e., mm/dd/yyyy), but not on timestamp.

Do I have use triggers for this or is there any other way to meet my requirement?


Thanks in advance.
Dinakar
This post has been answered by mtefft on Apr 12 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 10 2011
Added on Apr 12 2011
2 comments
3,585 views