Oracle日期参数

时间:2013-06-21 17:20:56

标签: oracle10g

我有一个查询,它为我创建了我想要的东西,但如果我开始使用参数,它说我并非所有变量都绑定。如何在以下select语句中查询两个日期?

任何帮助将不胜感激。

此致

select case vp.player_type
         when 'L' then
          lpm.last_name
         when 'C' then
          cpm.last_name
       end as last_name,
       case vp.player_type
         when 'L' then
          lpm.first_name
         when 'C' then
          cpm.first_name
       end as first_name,
       lag(ch.next_date) over(partition by ch.virtual_customer_id order by ch.end_date) as scheduled_date,
       ch.date_entered as start_com_date,
       ch.end_date as end_com_date,
       round(ch.date_entered - lag(ch.next_date)
             over(partition by ch.virtual_customer_id order by ch.end_date)) as date_dif,
       case
         when ch.date_entered - lag(ch.next_date)
          over(partition by ch.virtual_customer_id order by ch.end_date) > 45 then
          'overdue'
         else
          null
       end as overdue,
            tt.tot_actualloss as lg_loss,
            stt.tot_actualloss as slot_loss,
       ch.response,
       to_char(ch.notes) as notes,
       casinocrm.main.getUserName(ch.user_id) as entered_by,
       ch.next_date as next_com_date,
       ch.id as communication_id,
       ch.virtual_customer_id
  from casinocrm.communication_history ch
  join casinocrm.virtual_player vp
    on vp.id = ch.virtual_customer_id
  left join logismos.player_master lpm
    on lpm.link_id = vp.player_id
   and vp.player_type = 'L'
  left join casinocrm.potential_player_master cpm
    on cpm.link_id = vp.player_id
   and vp.player_type = 'C'
left join logismos.trak_totals tt
    on tt.memb_linkid = lpm.link_id
left join logismos.trak_totals_sl stt
    on stt.memb_linkid = lpm.link_id
 where ch.date_entered between TO_DATE(:startdate,'DD/MM/YYY' ) and TO_DATE(:enddate,'DD/MM/YYY' )

0 个答案:

没有答案