ORA-01840: input value not long enough for date format

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ck388

    ORA-01840: input value not long enough for date format

    I'm trying to perform a select query on an oracle database but I get
    this error.

    ORA-01840: input value not long enough for date format

    My query is:

    SELECT * FROM TIGER.VIEW_TNW_ MAINSTREAM WHERE
    TO_CHAR(SYSDATE ,'yyyy/mm/dd') =
    TO_CHAR(TO_DATE (DUE_DATE,'yyyy/mm/dd')-5,'yyyy/mm/dd')

    Does anyone know what's wrong?

    When I do:

    SELECT TO_CHAR(SYSDATE ,'yyyy/mm/dd') FROM TIGER.VIEW_TNW_ MAINSTREAM

    and

    SELECT TO_CHAR(TO_DATE (DUE_DATE,'yyyy/mm/dd')-5,'yyyy/mm/dd') FROM
    TIGER.VIEW_TNW_ MAINSTREAM

    i get no errors.

    Would it be the fact that I have NULL values in the DUE_DATE field?

    Thanks in advance for any help.

    Tim :-)
  • Jasper Scholten

    #2
    Re: ORA-01840: input value not long enough for date format

    Tim,

    If you write select statements as you did here, you will get into trouble
    with your code in the near future.

    Anyway, try:

    SELECT *
    FROM tiger.view_tnw_ mainstream
    WHERE trunc(due_date-5) = trunc(sysdate)

    It is expected that column DUE_DATE is a date column.

    HTH,

    --
    Jasper Scholten
    DBA / Application Manager / Systems Engineer


    "ck388" <google@timyee. comschreef in bericht
    news:698a71bb.0 311151753.21943 2b1@posting.goo gle.com...
    I'm trying to perform a select query on an oracle database but I get
    this error.
    >
    ORA-01840: input value not long enough for date format
    >
    My query is:
    >
    SELECT * FROM TIGER.VIEW_TNW_ MAINSTREAM WHERE
    TO_CHAR(SYSDATE ,'yyyy/mm/dd') =
    TO_CHAR(TO_DATE (DUE_DATE,'yyyy/mm/dd')-5,'yyyy/mm/dd')
    >
    Does anyone know what's wrong?
    >
    When I do:
    >
    SELECT TO_CHAR(SYSDATE ,'yyyy/mm/dd') FROM TIGER.VIEW_TNW_ MAINSTREAM
    >
    and
    >
    SELECT TO_CHAR(TO_DATE (DUE_DATE,'yyyy/mm/dd')-5,'yyyy/mm/dd') FROM
    TIGER.VIEW_TNW_ MAINSTREAM
    >
    i get no errors.
    >
    Would it be the fact that I have NULL values in the DUE_DATE field?
    >
    Thanks in advance for any help.
    >
    Tim :-)

    Comment

    Working...