Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Apr 2012
    St. Louis, MO
    Thanked 101 Times in 101 Posts

    ORACLE - SELECT (I'm sure I'm missing something simple)

    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:

    PHP Code:
    CID              UID            COMP_DATE
    109             DRYSJC         2012
    -06-27 10:24:57.0 
    Here is the query that should retrieve this record:
    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')
    This is not selecting the record. I know I'm new to Oracle, but shouldn't this work? What am I missing?

    UPDATE: Removing the to_date() from around COMP_DATE but leaving it around the value worked. ???

    Thank you,
    Last edited by WolfShade; 07-09-2012 at 11:06 PM. Reason: Fixed it

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts