Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

paul_bakker2
Active Contributor
0 Kudos

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

2 REPLIES 2

paul_bakker2
Active Contributor
0 Kudos

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

0 Kudos

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')