Skip to Content
0
Former Member
Nov 08, 2013 at 06:10 PM

Connection to Oracle DB from ABAP

90 Views

Hello,

I am trying to connect to Oracle DB from ABAP by using the following

select single dbms from dbcon into dbtype
where con_name = 'CON1'.

if sy-subrc = 0.

TRY.
IF sy-host EQ 'sapxxxxxx'.
EXEC SQL.
connect to 'CON1' as 'CON'
ENDEXEC.
ENDIF.

IF sy-subrc <> 0.

RAISE EXCEPTION TYPE cx_sy_native_sql_error.
ENDIF.

EXEC SQL.
set connection 'CON'
ENDEXEC.
CATCH cx_sy_native_sql_error INTO exc_ref.

LEAVE PROGRAM.
ENDTRY.
endif.

This is resulting in SQL error ORA-00900.

invalid SQL statement.

I am not sure what is wrong as the connection in DBCON is working fine.

Any idea.

Can some one give me any hint.

thanks,