home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / database / oracle / 2592 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.8 KB

  1. Path: sparky!uunet!noc.near.net!hri.com!spool.mu.edu!uwm.edu!cs.utexas.edu!torn!nott!cunews!echoy
  2. From: echoy@alfred.carleton.ca (Eugene Choy)
  3. Newsgroups: comp.databases.oracle
  4. Subject: Question using BETWEEN/AND cond with NEXT_DAY/DAY math
  5. Summary: Question on using BETWEEN/AND with NEXT_DAY/DAY math
  6. Message-ID: <echoy.724882423@cunews>
  7. Date: 20 Dec 92 20:13:43 GMT
  8. Sender: news@cunews.carleton.ca (News Administrator)
  9. Organization: Carleton University
  10. Lines: 41
  11.  
  12.  
  13. i am some trouble understanding how the BETWEEN/AND condition works
  14. in conjunction with the NEXT_DAY function and DAYs arithmatic.
  15.  
  16. The following statement displays 'ok' >
  17. SELECT 'ok' FROM DUAL WHERE 4 BETWEEN 4 AND 6;
  18. SELECT 'ok' FROM DUAL WHERE 5 BETWEEN 4 AND 6;
  19. SELECT 'ok' FROM DUAL WHERE 6 BETWEEN 4 AND 6;
  20.  
  21. which i assume that for the condition
  22.    WHERE a BETWEEN b AND c
  23. TRUE will be returned if 
  24.    b >= a >= c
  25. This is fine since it agrees with the oracle:sql maunual
  26.  
  27. Now, consider this statement 
  28.    (assume NEXT_DAY(sysdate,'sunday') returns 3-jan-93):
  29. ----------------------------
  30. SELECT 'ok' FROM DUAL 
  31. WHERE
  32.    to_date('1-jan-93','dd-mm-yy') BETWEEN
  33.    NEXT_DAY(sysdate,'sunday')-2 AND
  34.    NEXT_DAY(sysdate,'sunday');
  35. ----------------------------
  36. this does not return 'ok'!!!!!
  37. why is this the case? since,     
  38.    NEXT_DAY(sysdate,'sunday')-2                 means 01-jan-93
  39.    NEXT_DAY(sysdate,'sunday')                   means 03-jan-93
  40.  
  41.  
  42.  
  43.  
  44. pls email back or post , any suggestions will be appreciated
  45. #----------------------------------------------------------------------------
  46. from Eugene Choy
  47. echoy@alfred.ccs.carleton.ca
  48. Ottawa (the Nation's capital), Canada. North America.
  49. 'Software stands between the user and the machine'
  50. #----------------------------------------------------------------------------
  51.