cancel
Showing results for 
Search instead for 
Did you mean: 

declare exit handler not supported in repository

Former Member
0 Kudos

Hi,

I am attempting to create a procedure that has an exit handler in the repository but the validator will not allow the following syntax

          declare exit handler for sqlexception SELECT -500, 'cannot drop table' FROM DUMMY

incorrect syntax near ....    error at qp_gram.y:34124

for example:

create procedure yana_coding.model_i2c_cleanup

LANGUAGE SQLSCRIPT

SQL SECURITY INVOKER

AS

BEGIN

      declare exit handler for sqlexception SELECT -500, 'cannot drop table model' FROM DUMMY

begin

                    drop table model;

end;

END;

Seems the repository validator will not allow me to use this function.  Any other solution to capture errors?

Steven.

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

Hi Steven,

the general assumption for repository objects is that they will be read-only.

SQLScript procedures are meant as a means of code re-usability for processing steps, that are required in several models.

As exceptions are very often used for cases, where data gets modified, this feature is not available for SQLScript in repository objects.

You can either create this code outside your repository (with the need to organize the transport of the code yourself) or pass on the usage of exception handlers.

- Lars

Answers (1)

Answers (1)

Former Member
0 Kudos

Exception handling is history!  I just have to write better code

Thanks!

former_member184768
Active Contributor
0 Kudos

Exception Handling has just been introduced and not even fully documented, let's not kill it so soon .

I am very sure soon all the features, you are currently struggling with, will be made available for the repository objects (it is a wishlist item).

Thanks for bringing out all the issues so far, it has been a good learning.

Regards,

Ravi

Former Member
0 Kudos

Well as general rule exception handling is a general requirement in any modern programming environment.  Even with read-only data, errors can happen.  Being able to handle this in a elegant manner is way better then giving the user a "[SAP ERROR 209... ....]".  It's about building a robust environment and having the tools available for that.

lbreddemann
Active Contributor
0 Kudos

Yep - agreed.