Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Posts
    10

    Unanswered: SqlPlus Date/time help

    Hi I have created a table which has a location and time columns

    CREATE TABLE TEST
    (location CHAR(20) PRIMARY KEY,
    Time date );
    INSERT INTO TEST VALUES
    (1,TO_DATE('14:30:00','HH24:MIS'));

    When i

    select * from test;

    all i get from the time column is 1-Nov-07

    How do i insert the time in date field and then retrieve the entered time with a query

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    alter session set nls_date_format='YYYY-MON-DD:HH24:MI.SS';
    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
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Or, apply the desired format while selecting a value from this column, such as
    Code:
    SELECT TO_CHAR(this_column, 'dd.mm.yyyy hh24:mi:ss')
    FROM your_table
    WHERE ...

  4. #4
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    When you store only a time element in a date field, the field MUST contain a date, so it uses the date that it was inserted. To retreive only the time portion simply

    select to_char(my_column,'HH24:MI.SS')
    FROM MY_TABLE;
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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