query giving different results
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: query giving different results

  1. #1
    Join Date
    Aug 2000
    Posts
    33

    query giving different results

    Hello,

    While executing the following query the execution time is more since the to_date funtion used in where condition.

    select admission_date from iptran where to_date(admission_date) between to_date('26-10-2002','dd-mm-yyyy').

    But if
    select admission_date from iptran where admission_date between to_date('26-10-2002','dd-mm-yyyy');

    Results in no rows.

    HOw should I re-write this query to retrieve in a minimum of time ?

    Thanks in advance
    Ravi

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,448
    that cant be the whole query huh

    plus admission_date is date or varchar2, seems varchar2 to me, if that was the case how can you compare varchar2 to date doh

  3. #3
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    342
    implicit conversion from varchar2 -> date ?
    If so, it's most likely another date format is used then 'dd-mm-yyyy', which gives you other results.

    Always use explicit conversion.

    HTH

Posting Permissions

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



Click Here to Expand Forum to Full Width