I am trying to set up a form that will delete very specific records in a database. The table contains information on who has completed what training. This is annual training, so the same user/course can appear more than once. I need to be able to delete a specific course (ie, if the user has taken course 109 three times in four years, but the database shows four times in four years, I need to remove the one that isn't valid.)
I'm trying to do this based on user id, course id, and the datetime the course was recorded at.
The delete isn't working, and in an attempt to find out why, I'm trying to SELECT the record, first, to no avail even though it exists. In the database there is the following record:
CID UID COMP_DATE
109 DRYSJC 2012-06-27 10:24:57.0
Here is the query that should retrieve this record:
WHERE upper(UID) = 'DRYSJC'
AND CID = 109
AND to_date(COMP_DATE,'YYYY-MM-DD HH24:MI:SS') = to_date('2012-06-27 10:24:57','YYYY-MM-DD HH24:MI:SS')
This is not selecting the record. I know I'm new to Oracle, but shouldn't this work? What am I missing?
Removing the to_date() from around COMP_DATE but leaving it around the value worked. ???