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:
Here is the query that should retrieve this record:PHP Code:
CID UID COMP_DATE
109 DRYSJC 2012-06-27 10:24:57.0
This is not selecting the record. I know I'm new to Oracle, but shouldn't this work? What am I missing?Code:SELECT * FROM tableA 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')
UPDATE: Removing the to_date() from around COMP_DATE but leaving it around the value worked. ???