连接SQL,操作数据库
1:定义游标
DEFINE IBL_FETCH_DATA.
TRY.
EXEC SQL.
FETCH NEXT &3 INTO :&1
ENDEXEC.
CATCH CX_SY_NATIVE_SQL_ERROR.
&2 = '99'.
ENDTRY.
IF &2 NE 99.
&2 = SY-SUBRC.
ENDIF.
END-OF-DEFINITION.
* Close SQL Cursor
DEFINE IBL_CLOSE_CURSOR.
TRY.
EXEC SQL.
CLOSE &1
ENDEXEC.
CATCH CX_SY_NATIVE_SQL_ERROR.
&2 = '99'.
ENDTRY.
IF &2 NE 99.
&2 = SY-SUBRC.
ENDIF.