Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2008
    Posts
    117

    Unanswered: Timestamp in Oracle8

    Hi,
    I am using oracle8 version. I tried to add a column which takes time alone as the value(08:02:05) in this format. I googled and i found timestamp for time. But When i created table with that it specifies me as invalid datatype error.
    How to create a table with time column?

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    use DATE datatype
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Nov 2008
    Posts
    117
    when i use date datatype, i am getting error when adding time,
    Code:
    insert into table(journeytime)
    values('01-jan-2010 15:02:10')

  4. #4
    Join Date
    Jul 2003
    Posts
    2,296
    Quote Originally Posted by bharanidharanit View Post
    when i use date datatype, i am getting error when adding time,
    Code:
    insert into table(journeytime)
    values('01-jan-2010 15:02:10')
    read the documentation. are you familiar with a function named TO_DATE?
    oracle has no idea what you are doing and it will not guess for you.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  5. #5
    Join Date
    Jul 2003
    Posts
    2,296
    you say you googled this but the very first hit searching with "oracle insert date"
    provided a perfect example. I am just wondering why you would not follow the example.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  6. #6
    Join Date
    Nov 2008
    Posts
    117
    I already tried this also, but again running with errors..
    Code:
    insert into table(journeytime)
    values(to_date('01-jan-2010 15:02:10'))

  7. #7
    Join Date
    Jul 2003
    Posts
    2,296
    yet you don't post a description of the table OR THE ERROR.
    Help me help you.

    also, did you read the documentation regarding TO_DATE or even LOOK at the example from the google search?
    I don't think you did because you are not using the function correctly.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  8. #8
    Join Date
    Nov 2008
    Posts
    117
    in my documentation, i can see only examples of using date alone. And the error thrown is near my time column
    values(to_date('01-jan-2010 15:02:10'))

  9. #9
    Join Date
    Jul 2003
    Posts
    2,296
    you need to read and understand syntax code:
    The syntax for the to_date function is:

    to_date( string1, [ format_mask ], [ nls_language ] )

    For example, we could insert the '3-may-03 21:02:44' value as follows:

    PHP Code:
        insert into table_name
        
    (date_field)
        
    values
        
    (to_date('2003/05/03 21:02:44''yyyy/mm/dd hh24:mi:ss')); 
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  10. #10
    Join Date
    Nov 2008
    Posts
    117
    thankyou, i try this in my college, and let u know the status. thankyou

Posting Permissions

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