现在ORACLE库中有一张表lend_book,其中有两个字段start=当前系统时间;end=一个月后的相对时间。要求: 1 start如为2月28日/29日,则end应为3月31日;start为4月30日时,则end为5月31日;2,该记录值由VC中调用SQL语句插入,应如何写该语句?

解决方案 »

  1.   

    可以实现,如下:先得出当前日期(A)后一天的日期(B)(SQL语句中有函数,自己找找,我忘了)
    然后得出(B)后一个月的日期(C)
    然后把(C)减去一天就得到正确的结果(D)
      

  2.   

    m_oleDateTimeChange.ParseDateTime( m_strStartTime);//将STRING类型转换为时间型nDay = m_oleDateTimeChange.GetDay();//取得日nMonth = (m_oleDateTimeChange.GetMonth() + atoi( m_strEditText)) % 12;

    nYear = m_oleDateTimeChange.GetYear() + ( m_oleDateTimeChange.GetMonth() + atoi( m_strEditText)) / 12;
      

  3.   

    哦!望了说了!要你要得到一个月后的日期你就把m_strEditText赋值为1就可以了~m_oleDateTimeChange是COleDateTime类的一个对象!
      

  4.   

    ADD_MONTHS function is available in Oracle!