Results 1 to 6 of 6

Thread: Insert Date?

  1. #1
    Join Date
    Feb 2007
    Posts
    20

    Unanswered: Insert Date?

    I'm using 10g express.

    I have a table with a DATE field

    Using the 10 web interface I want to add a record with the date being entered on the web form '2007-01-01' but I keep getting errors.
    I get this error:
    'error ORA-01861: literal does not match format string'
    When I try to use the to_date() function on the web form like this:
    to_date('2007-01-01:12:00:00AM', 'yyyy/mm/dd:hh:mi:ssam')
    I get This error
    (error ORA-00907: missing right parenthesis)
    How can use use the web interface with 10g to insert a simple record with a DATE field? Thanks.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    Quote Originally Posted by landrun

    When I try to use the to_date() function on the web form like this:
    to_date('2007-01-01:12:00:00AM', 'yyyy/mm/dd:hh:mi:ssam')
    for one, you are not using the same FORMATTING.

    I see dashes in the date but SLASHES in the format.
    You need to make up your mind.

    to_date('2007-01-01:12:00:00AM', 'yyyy/mm/dd:hh:mi:ssam')
    should be:
    to_date('2007-01-01:12:00:00AM', 'yyyy-mm-dd:hh:mi:ssam')
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Feb 2007
    Posts
    20
    Okay, I copied and pasted your code:
    to_date('2007-01-01:12:00:00AM', 'yyyy-mm-dd:hh:mi:ssam')
    And still got this error:
    error ORA-00907: missing right parenthesis
    I'm using the web interface so I wouldn't think I'd need to use the to_date() function. But I might be wrong?
    I would think this would be about as simple as it could get.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,296
    I don't know anything about the Web Interface.
    I was just correcting your syntax.

    Your first error meant that you were inserting a character string into a date field. I would attempt to insert as the whatever the default date-format is.

    So, if when you select sysdate from dual you get: 28-MAR-07

    then type that into your Web Interface and see what you get.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  5. #5
    Join Date
    Feb 2007
    Posts
    20
    28-MAR-07
    Bingo!

    Thanks. That was it.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,296
    glad it worked.

    you can always change the database default date-format (nls_date_format) if you want to enter a different format into the Web Interface going forward.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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