FW: trap informix store procedure errors!

FW: trap informix store procedure errors!

Post by David Ree » Wed, 03 Jul 2002 22:22:26



I have found this problem, and related it to the use of blocks. Try to stay
away from the BEGIN and END if you don't need to use it.

David Reed

-----Original Message-----


Sent:   Tuesday, July 02, 2002 17:39
To:     new.cn99.com

Subject:        Re: trap  informix store procedure errors!

Make sure that you are issuing a RETURN to pass back the desired value. I
suspect that you have your exception handling slightly wrong.
Try this:
BEGIN
                ON EXCEPTION
SET sql_err_var;
                END EXCEPTION;
                ....other stuff
END
RETURN sql_err_var;
I assume that you are not RESUMEing after an exception. In this case the
RETURN should execute because it occurs outside the block that generates the
error. When an error occurs in SPL execution resumes after the block that
generates the error (as defined by begin and end).
I am doing this from memory, which is 100% defective, so the exact syntax
might not be correct.
Mark
----- Original Message -----


Sent:   Monday, July 01, 2002 10:11 PM
Subject:        trap informix store procedure errors!

> HELLO,

> SCO Unix
> Informix IDS 7.31.UC7
> procedure code as the additional(D_test.sql):
> but the error_trapping mechanism (ON EXCEPTION...END EXCEPTION)doesn't
work
> .

> I want to pass the procedure result (p_sql_err) to external application
( C
> language function ),
>     but the error_trapping mechanism does't work.
> No matter what errors occured ,the Proc_TestProc() always return as
follow:

> EXECUTE PROCEDURE Proc_TestProc('123','1111122222333334444455555');

> (expression)
> (expression)
> (expression)
> (expression)
> (expression)

>  1 row(s) retrieved.

 
 
 

1. trap informix store procedure errors!

Make sure that you are issuing a RETURN to pass back the desired value. I
suspect that you have your exception handling slightly wrong.

Try this:

BEGIN
      ON EXCEPTION
            SET sql_err_var;
      END EXCEPTION;
      ....other stuff
END
RETURN sql_err_var;

I assume that you are not RESUMEing after an exception. In this case the
RETURN should execute because it occurs outside the block that generates the
error. When an error occurs in SPL execution resumes after the block that
generates the error (as defined by begin and end).

I am doing this from memory, which is 100% defective, so the exact syntax
might not be correct.

Mark

2. Paradox 8 - Inability to Open Table

3. How can I trap informix store procedure errors!

4. pgsql/doc/src/sgml/ref create_trigger.sgml

5. Trapping Informix Stored Procedure Exceptions

6. SQL If Then Else: Solution

7. Using TQuery with Tedit components. Help!

8. Trap Entended stored procedure errors in DBLIB

9. DTS with stored procedures / error trapping

10. Trapping Errors Raised Within Stored Procedures

11. trapping errors in stored procedures (newbie)

12. Trapping errors from stored procedure calls