Sql Date and Time doubt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsrinivasan
    New Member
    • Mar 2007
    • 221

    Sql Date and Time doubt

    My Oracle table "sav" structure is

    order_entry_dat e ---- date
    order_entry_tim e ---- varchar2(10)

    select to_date(order_e ntry_date||' '||order_entry_ time, 'DD-Mon-YY HH12:MI am') as dates
    from sav;


    Result:

    DATES
    ---------

    01-JAN-07
    01-JAN-07
    01-JAN-07
    01-JAN-07

    I did not get Time..
    i do not know what is the reason for it..
    Anybody can help me.. plz...
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    First of all tell me why u need two different field to store date and time while u can u the same using a single field with data type date.
    In your case u dont need the second field at all.

    Comment

    • rsrinivasan
      New Member
      • Mar 2007
      • 221

      #3
      Originally posted by debasisdas
      First of all tell me why u need two different field to store date and time while u can u the same using a single field with data type date.
      In your case u dont need the second field at all.
      thanks for ur reply...
      Actually i have modified one project which has two fields to store date and time.
      As per the client requirement, i need to concat these fields.

      Comment

      • chandu031
        Recognized Expert New Member
        • Mar 2007
        • 77

        #4
        Hi,

        If you need a timestamp output, use the TO_TIMESTAMP function instead of to_date.

        Comment

        Working...