Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

An SQL error has occurred: ORA-00923: From keyword not found where expected

TRY.
        EXEC SQL.
          OPEN dbcur FOR
            SELECT  B.SCI_CART_NO
                    B.SCI_MATL_NO
                    B.SCI_QTY
                    B.SCI_RCV_PLANT
                    B.SCI_RCV_STRG_LOC
                    C.SCM_FOD_NO
                    D.saa_category
                    D.SAA_ASGND_TO
                   FROM   T_SHOPPING_CART_ITEM  B,
                          T_SHOPPING_CART_MANF  C,
                          T_SC_ACCT_ASGNMT  D,
                   WHERE C.SCM_CART_NO = B.SCI_CART_NO
                   AND   D.SAA_CART_NO = B.SCI_CART_NO
                   AND   B.SCI_CART_NO = :t_wa_aufk_cobrb-scm_cart_no

        ENDEXEC.
      CATCH cx_sy_native_sql_error INTO t_exc_ref.
        w_error_text_oc = t_exc_ref->get_text( ).
        MESSAGE w_error_text_oc TYPE 'E'.
    ENDTRY.
TRY.
        DO.

          EXEC SQL.
            FETCH NEXT dbcur INTO :t_wa_ora-SCI_CART_NO,
                                  :t_wa_ora-SCI_MATL_NO,
                                  :t_wa_ora-SCI_QTY,
                                  :t_wa_ora-SCI_RCV_PLANT,
                                  :t_wa_ora-SCI_RCV_STRG_LOC,
                                  :t_wa_ora-SCM_FOD_NO,
                                  :t_wa_ora-saa_category,
                                  :t_wa_ora-SAA_ASGND_TO
          ENDEXEC.

          IF sy-subrc <> 0.
            EXIT.
          ELSE.
            t_wb_ora-sci_cart_no      = t_wa_ora-sci_cart_no.
            t_wb_ora-sci_matl_no      = t_wa_ora-sci_matl_no.
            t_wb_ora-sci_qty          = t_wa_ora-sci_qty.
            t_wb_ora-sci_rcv_plant    = t_wa_ora-sci_rcv_plant.
            t_wb_ora-sci_rcv_strg_loc = t_wa_ora-sci_rcv_strg_loc.
            t_wb_ora-scm_fod_no       = t_wa_ora-scm_fod_no.
            t_wb_ora-saa_category     = t_wa_ora-saa_category.
            t_wb_ora-saa_asgnd_to     = t_wa_ora-saa_asgnd_to.
            APPEND t_wb_ora TO t_ora.
            CLEAR : t_wb_ora, t_wa_ora.
          ENDIF.
        ENDDO.
      CATCH cx_sy_native_sql_error INTO t_exc_ref.
        w_error_text_fc = t_exc_ref->get_text( ).
        MESSAGE w_error_text_fc TYPE 'E'.
    ENDTRY.

After execution of "FETCH NEXT dbcur INTO :t_wa_ora-SCI_CART_NO,...." I am getting an SQL Error ""An SQL error has occurred: ORA-00923: From keyword not found where expected"". please guide to resolve..

Thanks & regards

Saifur Rahaman

Former Member replied

Hi,

In native SQL don't forget to separate the SELECT list with ", "

SELECT  B.SCI_CART_NO      ,
                    B.SCI_MATL_NO ,
                    B.SCI_QTY      ,
                    B.SCI_RCV_PLANT ,
                    B.SCI_RCV_STRG_LOC ,
                    C.SCM_FOD_NO ,
                    D.saa_category ,
                    D.SAA_ASGND_TO
                   FROM   T_SHOPPING_CART_ITEM  B,
                          T_SHOPPING_CART_MANF  C,
                          T_SC_ACCT_ASGNMT  D
                   WHERE C.SCM_CART_NO = B.SCI_CART_NO
                   AND   D.SAA_CART_NO = B.SCI_CART_NO
                   AND   B.SCI_CART_NO = :t_wa_aufk_cobrb-scm_cart_no

...

bye

yk

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question