Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: sql or pl sql to do this?

Re: sql or pl sql to do this?

From: Mark <markg_at_mymail.co.uk>
Date: 13 May 2002 07:33:52 -0700
Message-ID: <ddb31653.0205130633.1523602@posting.google.com>


Can be done in pure SQL.

  1. Create a function called OBJECT_DATE_BETWEEN which takes in your start date and end date. The function then compares the start date and end date with the dates in your table 'objects'. If dates are in range, return YES otherwise NO.
  2. You then create SQL like

SELECT code_object, OBJECT_DATE_BETWEEN(date_in, date_out) ans FROM objects;

It should produce something like

code_object ans
----------- ---

object1     yes
object2     yes
object3     no
object4     yes  

I would write the OBJECT_DATE_BETWEEN for you but i havent time! ;-)

HTH, M

"gil guerillot" <gil.guerillot_at_ratp.fr> wrote in message news:<abo296$1f70$1_at_gotix.reseau.ratp>...
> i 'd like to know with sql if an object is installed between 2 dates
> (start_date and end_date) in a where clause
>
> table objects: code_object,date_in ,date_out
>
> i want a result like this
>
> object1 yes
> object2 yes
> object3 no
> object4 yes ....
Received on Mon May 13 2002 - 09:33:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US