pl/SQL报错提示:
inconsistent datatypes:expected date got number
下面是PL/SQL语句:
--and to_char(wsh.last_update_date, 'yyyy-mm-dd')>=:p_begin_date
--and to_char(wsh.last_update_date, 'yyyy-mm-dd')<=:p_end_date
--我把上面的两个时间参数修改成下面的格式以后就显示PL/SQL的错误提示了,但按照上面的格式却没有显示数据也没报错
and wsh.last_update_date between &p_begin_date and &p_end_date

解决方案 »

  1.   

    你的&p_begin_date的输入是什么类型?
      

  2.   

    &p_begin_date and &p_end_date 是date型,而你只是输入了一串数字,被oracle作为number型参数。输入参数to_date('','')
      

  3.   

    当我换成下面的格式时也是这样:
    and trunc(wsh.last_update_date) between nvl(&p_begin_date,to_date(wsh.last_update_date)) and nvl(&p_end_date,to_date(wsh.last_update_date))
      

  4.   


    to_date(wsh.last_update_date,'yyyy-MM-dd') between &p_begin_date and &p_end_date 
      

  5.   

    你输入的是什么类型,oracle直接接收number型,如果是字符型,则加单引号,例如:'&n',
    你要求输入的是字符型,因此加上单引号,
    and wsh.last_update_date between '&p_begin_date' and '&p_end_date'
    以上,请试一下
      

  6.   

    -->
    to_date里面搞错了
     and trunc(wsh.last_update_date) between nvl(&p_begin_date,to_date(&p_begin_date, 'yyyy-mm-dd')) and nvl(&p_end_date,to_date(&p_end_date, 'yyyy-mm-dd'))
      

  7.   

    大家意见我都试过了,还是报错
    pl/SQL报错提示: 
    inconsistent datatypes:expected date got number 
      

  8.   

    and wsh.last_update_date between to_Date(p_begin_date,'yyyy-mm-dd') and to_Date(p_end_date,'yyyy-mm-dd')
      

  9.   

    to_date(wsh.last_update_date,'yyyy-MM-dd') between &p_begin_date and &p_end_date