Re: Need help with simple sql syntax

From: <vancejd_at_bclcl1.im.battelle.org>
Date: 1996/05/03
Message-ID: <66549.3189e228_at_bclcl1.im.battelle.org>#1/1


In article <mruggiero-0205960816210001_at_gatebs1-01.access.ch>, mruggiero_at_access.ch (Markus Ruggiero) writes:

>>I think you can try sysdate -14

>
>
> Thanks to all who have responded but...
> I am talking about Oracle Rdb (ex DEC Rdb) NOT Oracle7.
>
> Question still open
>
> ---markus---

Based on the information you provided, the responses posted to this group (and comp.databases.rdb) were reasonable.

In Rdb however, there is more than one 'style' of date. A column may be defined as DATE VMS or DATE ANSI.

Date arithmetic may only be performed on data that is in DATE ANSI format. Shown below are examples on how to:

  • CAST a column that is in DATE VMS format into DATE ANSI format and then perform date arithmetic.
  • Peform date arithmetic on a column defined as DATE ANSI.

[------------- From comp.databases.rdb --------------]

If 'timeField' is defined as DATE VMS try:

  select * from myTable where
    cast( timeField as date ansi ) <
    (current_date - interval '14' day);

If 'timeField' is defined as DATE ANSI try:

  select * from myTable where

      timeField < (current_date - interval '14' day);

[------------------------------------------------------]

If neither of the methods above work, you need to provide more information (perhaps in comp.databases.rdb).

  1. The version of Rdb.
  2. The format of 'timeField'.
  3. A log of your specific query.
  4. The error messages being returned.

[EOB] Received on Fri May 03 1996 - 00:00:00 CEST

Original text of this message