select * from aa where TO_CHAR(workday,'YYYYMMDD') ='20030528'

解决方案 »

  1.   

    select * from aa where workday BETWEEN TRUNC(SYSDATE) AND TRUNC(SYSDATE+1)
    效率比较高
      

  2.   

    用日期字符转换函数即可:select * from aa where workday = TO_DATE('28052003','DDMMYYYY');
      

  3.   

    楼上的写法有错误,如果workday中存储的日期有小时、分、秒的话,这样的查询无法查出结果。
      

  4.   

    用to_char确实可以,
    不够速度好象较慢。
    请问用select * from aa where workday BETWEEN TRUNC(SYSDATE) AND TRUNC(SYSDATE+1)
    那么sysdate是什么?是今天吗?
    那如果我要写某一天呢?
      

  5.   

    如果你要指明某一天,可以使用TO_DATE函数
    TO_DATE(20030501,'YYYYMMDD')
      

  6.   

    请问字段mm 类型 varchar2
    在ASP中写SQL语句出错.
    sql="select count(*) from aa where mm='"&request.form("cc")&"' "
    提示:user requested cancel of current operation
    请问是什么原因呢?
    不胜感谢.
    varchar2 在查询中是否也要使用函数定义格式呢?
      

  7.   

    估计这不是数据库端的问题,是ASP的问题。
      

  8.   

    不好意思,这个错误确实是ORACLE的错误,我帮你在METALINK上查一下。
      

  9.   

    Problem Explanation: 
    ==================== 
    ADO gives an interface to execute the stored procedure called  command object. ADO has a property called CommandTimeout which  is by default set to 30 seconds. If the stored procedure is taking  longer than this, the execution of the stored procedure is canceled  and user gets the above error. Problem Solution: 
    ================= 
    Set the CommandTimeout property of the command Object to 0  programatically.   Note: 
    ====== 
    Setting the CommandTimeout on the Connection Object is not the same  as setting it on the Command object.  See the following excerpt  from the ADO API Reference:  The CommandTimeout setting on a Connection object has no effect on the CommandTimeout setting on a Command object on the same Connection; that is, the Command object's CommandTimeout property does not inherit the value of the Connection object's CommandTimeout value.  Basically, you can set this on the Command Object but setting this on the Connection object will have no effect.  Also, since the CommandTimeout uses OCIBreak, it is subjected to the  limitations of that call. Meaning it may not work consistently on windows. This same call will not work with the Oracle Provider for OLE DB, since it does not implement OCIBreak in the provider. This will only work with the Oracle ODBC Driver.
      

  10.   

    select * from aa where workday = TO_DATE('28052003','DDMMYYYY');
      

  11.   

    不用使用函数,语句没有错语
    sql="select count(*) from aa where mm='"&request("cc")&"'"
      

  12.   

    是不是asp超时呢?不过超时的提示好象也不是这样.