cancel
Showing results for 
Search instead for 
Did you mean: 

Exception SQL not catched

Former Member
0 Kudos

Hi all, I am accessing to a external system in order to get some information.

TRY.

EXEC SQL.

OPEN C1 for

SELECT

GU010210,

GU010250

from GU01TB01

where GU010030 = :pi_pernr

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT C1 into :lw_contacto

ENDEXEC.

IF sy-subrc EQ 0.

po_extension = lw_contacto-extension.

po_email = lw_contacto-email.

CLEAR lw_contacto.

ENDIF.

EXIT.

ENDDO.

  • Treat errors

CATCH cx_root INTO exc_ref.

CLEAR: po_extension,

po_email.

ENDTRY.

  • Close connection

TRY.

EXEC SQL.

CLOSE C1

ENDEXEC.

CATCH cx_root INTO exc_ref.

CLEAR: po_extension,

po_email.

ENDTRY.

If I try to get information of a employee that does not exist in the external system, I am getting the exception:

EXSQL_DSQL_CURSOR_NOT_FOUND

The cursor "C1" is unknown.

Can someone know how can I resolve this please? I was thinking that cx_root was the exceptions root.

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Yashpal
Active Contributor
0 Kudos

Hi Jorge ,

have u declared the cursor in ur program ..

data : c1 type cursor .

Regards ,

Yashpal

Answers (2)

Answers (2)

Former Member
0 Kudos

I fixed the problem changing the position of close C1 after fetch data.

Regards!

Former Member
0 Kudos

Yes, the cursos is declared, but still not working.

Thanks for reply!

Former Member
0 Kudos

Hi!

You are trying to catch an exception called EXSQL_DSQL_CURSOR_NOT_FOUND. This is not part of the class-based exceptions under cx_root ...

I'm not sure, but I think you cannot catch this exception (there are several exceptions which cannot be caught and which lead to a runtime error).

You may try it with CATCH SYSTEM-EXCEPTIONS exc1 = rc1 ... excn = rcn instead of cx_root. These are the "old-fashioned" exceptions.

Regards,

Volker