Results 1 to 4 of 4

Thread: Help in To_Char

  1. #1
    Join Date
    Jan 2003
    Location
    Woking
    Posts
    107

    Unanswered: Help in To_Char

    Hi,

    I would like to know what is the significance of the following
    format in the TO_CHAR Function

    TO_CHAR(SYSDATE,'HH24:MISSSS')

    Any help would be of great use.
    nn

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Help in To_Char

    Originally posted by NoviceNo1
    Hi,

    I would like to know what is the significance of the following
    format in the TO_CHAR Function

    TO_CHAR(SYSDATE,'HH24:MISSSS')

    Any help would be of great use.
    It gives the current time as hour (24 hour clock) : minute : number of seconds since midnight, e.g.:

    SQL> select TO_CHAR(SYSDATE,'HH24:MIS'), TO_CHAR(SYSDATE,'HH24:MISSSS')
    2 from dual;

    TO_CHAR( TO_CHAR(SYS
    -------- -----------
    10:23:17 10:23:37397

    Quite why you would want the time in that format I couldn't say!

  3. #3
    Join Date
    Jan 2003
    Location
    Woking
    Posts
    107

    Re: Help in To_Char

    Originally posted by andrewst
    It gives the current time as hour (24 hour clock) : minute : number of seconds since midnight, e.g.:

    SQL> select TO_CHAR(SYSDATE,'HH24:MIS'), TO_CHAR(SYSDATE,'HH24:MISSSS')
    2 from dual;

    TO_CHAR( TO_CHAR(SYS
    -------- -----------
    10:23:17 10:23:37397

    Quite why you would want the time in that format I couldn't say!
    Hi,

    I have a code which uses time in that format to get unique file name.
    So I was curious as to what it was ?

    Thanks for the help.
    nn

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Help in To_Char

    Originally posted by NoviceNo1
    Hi,

    I have a code which uses time in that format to get unique file name.
    So I was curious as to what it was ?

    Thanks for the help.
    The 'HH24:MI:' part is redundant - may as well just use TO_CHAR(SYSDATE,'SSSSS').

    It won't be unique if you run the SQL again at the same time tomorrow!
    Would it not be better to use a SEQUENCE?

Posting Permissions

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