DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: date Problem - Urgent

  1. #1
    Join Date
    Apr 2001
    Posts
    69
    When I select sysdate from dual, I get only first 2 digits of the year portion.

    eg:

    select sysdate from dual;

    05-JUN-20

    Logically it should be either 05-JUN-01 OR 05-JUN-2001

    NLS_DATE_FORMAT is set as DD-MON-RRRR ( for DD-MON-YYYY also the result is the same)

    I would appreciate your suggestion.

    SPN

  2. #2
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    Would this provide a solution? It works on my machine.

    select to_char(sysdate, 'DD-MON-YYYY') from dual;
    David Knight
    OCP DBA 8i, 9i, 10g

  3. #3
    Join Date
    Apr 2001
    Posts
    69
    It's not working. Did you face similar probelm.

  4. #4
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    what does:
    select to_char(sysdate,'mm/dd/yyyy hh24:mi:ss') from dual;

    show?
    Jeff Hunter

  5. #5
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    What kind of tool are you using for those queries? Is it a kind of GUI tool that displays the results in a grid? Is it possible that the field for your result in this grid is too narrow, so that only part of the whole string is displayed?

    What is the result of the following:

    SELECT TO_CHAR(SYSDATE), LENGTH(TO_CHAR(SYSDATE)) FROM dual;
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  6. #6
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    I do not have an NLS_DATE_FORMAT set, but I have no problems.

    What is the result when you use RRRR or YYYY? Both of those work fine for me.

    David Knight
    OCP DBA 8i, 9i, 10g

  7. #7
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    First alter the session.
    SQL> alter session set nls_date_format='DD-MON-RRRR HH24:MI:SS';

    Session altered.

    SQL> SELECT SYSDATE FROM DUAL;

    SYSDATE
    --------------------
    05-JUN-2001 11:36:47

  8. #8
    Join Date
    Apr 2001
    Posts
    69
    Hi Friends,

    Thanks to all. I tried all these but still the problem is the same. I am not using any GUI tool. It's coming on the OS prompt itself. It's on UNIX.

    SPN

  9. #9
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    342
    I know it may sound like a silly remark but

    Have you checked the system time in unix using the 'date' command ?

    Gert

  10. #10
    Join Date
    Nov 2000
    Posts
    245

    looks like your date field is truncated.

    - exist from sqlplus and login again
    - check your login file

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