Parameters in stored procedures

Ivan Smahin ivan_smahin at paradigmasoft.com
Thu Sep 20 07:02:26 CDT 2007


Hello Bart,

Thursday, September 20, 2007, 2:50:40 PM, you wrote:


> If the Stored Procedure generates a valentina error will this error  
> be known to the client that made the call?

Yes, it will be thrown as usual. And SP will exit on this point.

> To be more specific, will for a RealBasic Project a  
> ValentinaException be raised or do we have to handle the error inside
> the stored procedure?

It is possible to raise errors inside sp.

Example:
CREATE PROCEDURE sp1()
BEGIN
    RAISE 50001, 'Some user error';
END
                                        
It is possible to handle errors inside sp.

Examples:

CREATE PROCEDURE sp1()
BEGIN
    RAISE 50001, 'Some user error';
EXCEPTION
WHEN 50001 THEN
    SET @v1 = 10;
END


CREATE PROCEDURE sp1()
BEGIN
    INSERT INTO t1 VALUES(1);
    INSERT INTO t1 VALUES(1);
EXCEPTION
WHEN ERR_CONSTRAINT_UNIQUE_VIOLATION THEN
    SET @v1 = 10;
WHEN 50000 THEN
    SET @v1 = 100;
WHEN OTHERS THEN
    SET @v1 = 1000;
END

-- 
Best regards,
Ivan Smahin 
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list