+ Reply to Thread + Post New Thread
Results 1 to 3 of 3
  1. #1
    laxman's Avatar
    laxman is offline Forum Expert
    Join Date
    21 Mar 2009
    Location
    MUMBAI
    Posts
    138
    Say Thanks
    6
    Thanked 0 Times in 0 Posts
    Documents
    0
    Uploads
    0

    Default date manipultation issue reg

    Dear all,
    i have one table

    Code sql:
    sql>desc request
    Name                       NULL?             Type
    ---------------------- ---------       -----------------
    reqid                      NOT NULL   NUMBER(10)
    requestname                            Varchar2(20)
    STATUS                                       varchar2(10)
    lastmoddate                            date

    i need to retreive lastmoddate record based on some condition given below,also i have written query for each requirement,but date manipulation logic is correct or not i am not sure,kindly help me out to modify the logic if it is not correct.

    Requirement one: search requests that have been assigned but in pending state for more than 24hrs

    Code sql:
    sql> SELECT reqid,requestname FROM request WHERE lastmoddate<sysdate - 1 AND STATUS='pending';

    Requirement two: search requests that have been assigned but in escalated state for past 8 hrs
    Code sql:
    sql> SELECT reqid,requestname FROM request WHERE lastmoddate<sysdate - 8/24 AND STATUS='escalated';

    Requirement two: search requests that have been assigned but in closed state for two weeks
    Code sql:
    sql> SELECT reqid,requestname FROM request WHERE lastmoddate>sysdate - 14 AND STATUS='closed';

    Thanks n regards
    Laxman

  2.    Club-Oracle Complementary E-Books and Magazines
    Get your free Complementary Copy of Oracle Magazine

    You can also browse the Free Magazines and E-Books section to see the complete list of free magazines, e-books and Whitepapers.

  3. #2
    rajavu's Avatar
    rajavu is offline Forum Genius
    Join Date
    13 Oct 2008
    Location
    @ Bangalore , India
    Posts
    471
    Say Thanks
    0
    Thanked 20 Times in 19 Posts
    Documents
    0
    Uploads
    0

    Default Re: date manipultation issue reg

    All Fine Except last one. For the last one it should be < sign.

    Code sql:
    SELECT reqid,requestname FROM request WHERE lastmoddate<sysdate - 14 AND STATUS='closed';

    Or you can use <= bases on your requirement.

    Raj.

  4. #3
    laxman's Avatar
    laxman is offline Forum Expert
    Join Date
    21 Mar 2009
    Location
    MUMBAI
    Posts
    138
    Say Thanks
    6
    Thanked 0 Times in 0 Posts
    Documents
    0
    Uploads
    0

    Default Re: date manipultation issue reg

    thanks a lot sir.


    Regards
    Laxman

Similar Threads

  1. date manipultation reg
    By laxman in forum SQL PL/SQL
    Replies: 3
    Last Post: 01-11-2010, 03:08 AM
  2. Problem in date comparison
    By JLone in forum SQL PL/SQL
    Replies: 2
    Last Post: 09-25-2009, 12:39 PM
  3. Converting AUG-09 to date in Oracle-SQL
    By Farshad Javadi in forum SQL PL/SQL
    Replies: 2
    Last Post: 08-13-2009, 10:05 PM
  4. date counting help
    By tomukaz in forum SQL PL/SQL
    Replies: 3
    Last Post: 10-21-2008, 07:05 AM

Tags for this Thread