When will BatchSQLException be raised? [message #175687] |
Sun, 04 June 2006 18:51 |
jamesbdarcy
Messages: 1 Registered: June 2006
|
Junior Member |
|
|
Under what circumstances will a BatchSQLException be raised? What type of error needs to be thrown in a SQL statement (within a batch of statements) to cause this exception to be thrown by the OCCI library?
I have been successfull in using calls to Statement::setMaxIterations(), Statement::addIteration() and Statement::executeUpdate() to send multiple statements to the database in a single network trip. The SQL being called is a stored procedure taking 3 IN parameters. All is going well for the case of a succesfull SQL statement.
But I want to be able to handle the case where not all statements are successful. For example, if I send 20 statements in a single batch and one fails, I want to handle the error as best as possible. Even if I have to roll back all statements, it would be nice to know which specific statement within the batch failed.
The OCCI documentation suggests a call to Statement::setBatchErrorMode(true) followed by a catch block catching BatchSQLException objects seems to do the trick. However, in my unit testing, I don't seem to be able to force such an exception.
In short, what sort of error do I need to force in my SQL code so that a BatchSQLException will be raised?
I have tried raising an exception in the SQL code but that seems to skip the BatchSQLException exception handler and go straight to the following SQLException handler. Is there some PL/SQL code that I need to place in my stored procedure?
Thanks in advance.
|
|
|
|