关于oracle时间转换的一个小小疑问



select rownum ro,
       q.que_id,
       q.lib_id,
       q.que_code,
       q.type_code,
       q.base_code,
       q.diff_code,
       q.knowledge_id,
       q.ability_code,
       q.create_user,
       q.create_time,
       q.is_big_text,
       q.parent_id,
       q.que_version,
       q.casual,
       q.choise,
       q.answer,
       q.clob_casual,
       q.clob_choise,
       q.clob_answer,
       q.score,
       q.answer_time,
       q.source_code,
       q.source_code as sourceName,
       q.use_count,
       q.is_approved,
       q.is_avail,
       q.start_time,
       q.end_time,
       q.byinfor,
       q.update_time,
       q.update_user,
       (select dir_name from directorys where dir_id = q.lib_id) as lib_name,
       (select type_name from question_type where type_code = q.type_code) as type_name,
       (select diff_name
          from question_difficulty
         where diff_code = q.diff_code) as diff_name,
       (select qk_name
          from question_knowledge
         where knowledge_id = q.knowledge_id
           and type_code = 'K') as qk_name,
       (select ability_name
          from question_ability
         where ability_code = q.ability_code) as ability_name,
       secret
  from questions q
 where (end_time >= to_date('2016-09-20 09:54:03.375','YYYY-MM-DD HH24:MI:SS.FF3') or end_time is null)
   and is_avail = 'Y'
   and is_approved = 'Y'
   and parent_id = -1
   and q.que_id not in (select impl_que_id
                          from part_question
                         where partition_id in
                               (select pp.partition_id
                                  from paper_partition pp
                                 where pp.partition_exam_paper = 530501)
                           and impl_que_id is not null)
   and is_deleted = 'N'
   /*不注释这一行能执行,注释掉就报错*/
   /*and (exam_wh_id in (-11716325) or exam_wh_id = 11716325)*/
   and is_course = 'Y'
 order by update_time desc




整个sql语句就用到了这么一个时间转换的地方,尚未发现有什么问题,过段时间再仔细研究一下。
to_date('2016-09-20 09:32:34.382','yyyy-MM-dd HH24:mi:ss.ff3')



难道是因为下面的条件已经把数据都筛选没了,而时间那个条件还没来得及执行?

猜你喜欢

转载自gonethen.iteye.com/blog/2325715
今日推荐