Skip to Content

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

Error handling in Native SQL for ORACLE

Hi,

I have the next code:

DATA instr TYPE char4.

EXEC SQL.

SELECT INSTRUMENTO INTO instr FROM DATOSMAESTROS

END EXEC.

And I want to control if the select has no results. Is it possible with the statement EXCEPTION inside EXEC SQL? Something like that:

DATA instr TYPE char4.

EXEC SQL.

SELECT INSTRUMENTO INTO instr FROM DATOSMAESTROS WHERE id_inst = '01'

EXCEPTION

WHEN NO_DATA_FOUND THEN

:err = SQLCODE

INSERT INTO error( field, code_err) VALUES ( 'instrumento',:err)

END EXEC.

Is this a correct code? If not, how can I do it?

Thank you all,

Cris.

Tags:
Not what you were looking for? View more on this topic or Ask a question