SQL> select 1 from dual where to_date('2003-08-07','yyyy-mm-dd') = '2003-08-07';         1
----------
         1已用时间:  00: 00: 00.31
SQL> select 1 from dual where to_date('2003-08-07','yyyy-mm-dd') = '20030807';         1
----------
         1已用时间:  00: 00: 00.30
SQL> select 1 from dual where trunc(sysdate)='20030807';         1
----------
         1已用时间:  00: 00: 00.20
SQL> select 1 from dual where trunc(sysdate)='2003-08-07';         1
----------
         1已用时间:  00: 00: 00.30
SQL> 根据上面的实验,应该是可以的

解决方案 »

  1.   

    declare
    dateval date;
    val table_a.column1%type;
    begin
    ...
    select table_a.column1 into val from table_a where datecolumn = dateval;
    dbms_output.put_line(val);
    end;
    /
      

  2.   

    你的意思是不是ORACLE只能在存储过程中进行时间型的比较约束?
      

  3.   

    时间型和整形等其他数据类型一样可以进行直接比较的
    两个date类型的变量可以进行比较,但要注意你需要的比较精度
    是精确到小时、天还是年
    这样的话就需要用trunc()来进行规范