DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Funney SQL

  1. #1
    Join Date
    Dec 1999
    Location
    Alpharetta, GA, US
    Posts
    192

    Funney SQL

    here i want to select all the rows where
    1. next_retry < end_retry
    2. next_retry < sysdate

    when i ran this query event thought the next_retry is not lessthan the sysdate, the query giving back the results. you can see the
    data here.


    SQL> select * from git_retry WHERE next_retry < end_retry
    2 AND next_retry < sysdate;

    SISDN SID GIT_MSG_NU PROFILE_ID WELCOME_MSG ICCID
    ---------- ---------- ----------- ---------- ----------- --------------------
    MARKET_ID END_RETRY NEXT_RETR RETRYED RETRY_COUNT SOURCE_ID
    ---------- --------- --------- ---------- ----------- ----------
    7706491001 7706491000 310.410 9500 0 8901111111111111111
    101 12-DEC-02 11-DEC-02 1 1 1

    7706491000 7706491000 310.410 9500 0 8901111111111111111
    101 12-DEC-02 11-DEC-02 1 1 1

    SQL> select to_char(NEXT_RETRy,'YY-MM-DD HH:MI:SS') from git_retry;

    TO_CHAR(NEXT_RETRY
    -----------------
    02-12-11 02:56:12
    02-12-11 02:55:56

    SQL> select to_char(sysdate,'YY-MM-DD HH:MI:SS') from dual;

    TO_CHAR(SYSDATE,'
    -----------------
    02-12-11 02:52:01

    Thanks.

  2. #2
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    The HH format gives a 1-12 hour value so you may have a confusion between 02 hrs and 14 hrs. Try with HH24:
    select to_char(NEXT_RETRY,'YY-MM-DD HH24:MI:SS') from git_retry;
    "The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman

  3. #3
    Join Date
    Mar 2002
    Posts
    534
    Also try with YYYY maybe it is 01 instead of 2001:
    select to_char(NEXT_RETRY,'YYYY-MM-DD HH24:MI:SS') from git_retry;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width