Skip to Content
author's profile photo Former Member
Former Member

SQL: ORA-01843: not a valid month - SQL Native

hI,

I have the selection below by DBLink:

TRY.

EXEC SQL.

CONNECT TO :vg_dbs

ENDEXEC.

EXEC SQL.

SET CONNECTION :vg_dbs

ENDEXEC.

EXEC SQL.

OPEN c1 FOR

SELECT CON_DSSNOME, CON_NUSCICNUMERO, SOR_DTDRESCISAO

FROM VW_DESLIGADOS

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT c1 INTO :wa_apdata-con_dssnome, :wa_apdata-con_nuscicnumero, :wa_apdata-sor_dtdrescisao

ENDEXEC.

IF sy-subrc = 0.

APPEND wa_apdata TO ti_apdata.

ELSE.

EXIT.

ENDIF.

ENDDO.

EXEC SQL.

CLOSE c1

ENDEXEC.

CATCH cx_sy_native_sql_error INTO vg_exc_ref.

vg_text = vg_exc_ref->get_text( ).

MESSAGE e012(zbc001) WITH vg_text.

ENDTRY.


when I run the program, the following error appears:

SQL: ORA-01843: not a valid month

But, even if I do not select the date field "sor_dtdrescisao", the error persists.

Could you help me please?

Wagner

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Dec 10, 2014 at 05:58 AM

    Hi,

    The date being fetched probably contains an illegal month value (like '13')

    Check the table contents, or the structure of the fields you are reading into.

    cheers

    Paul

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      The problem was in view in Oracle.

      There was one condition to date be converted into a format that the SAP can read.

      Once corrected in Oracle, SAP read smoothly.

      SOR_DTDRESCISAO >= TO_DATE('01/01/2011','DD/MM/YYYY')






Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.