Consultor Eletrônico



Kbase P111718: Running STORED-PROC send-sql-statement with load-results-into and NO-ERROR does not suppress error 2
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/30/2009
Status: Verified

SYMPTOM(s):

Running STORED-PROC send-sql-statement with load-results-into and NO-ERROR does not suppress error 2101

incorrect select statement in send-sql-statemment causes error 2101

No active stored procedures. (2101)

FACT(s) (Environment):

MS SQL DataServer
Oracle DataServer

CAUSE:

This is a known issue. There is an implicit close stored-proc executed right after the run stored-proc, and since the close stored-proc statement doesn't have a no-error option, the errors from it can not be suppressed. If the stored-proc executes with no problem, then any other errors during the execution of the load-result-into option can be trapped. The only situation that can't be suppressed is when the select statement is incorrect and that is because we can't suppress the error from the implicit close stored-proc statement.

FIX:

The close stored-proc generates a stop condition. The following code will catch errors other than the incorrect select statement:
do on stop undo, leave:
run stored-proc send-sql-statement load-results-into <handle> no-error ("select...").
end.
if error-status:error then do:
.......
end.
This will trap the stop condition and will enable the code to get the error messages.