Parameters in stored procedures
Bart Pietercil
bart.pietercil at gmail.com
Thu Sep 20 07:33:07 CDT 2007
On 20-sep-07, at 14:02, Ivan Smahin wrote:
> 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
>
>
OK for that , thanks Ivan
Still when I do
> CREATE PROCEDURE sp1()
> BEGIN
> RAISE 50001, 'Some user error';
> EXCEPTION
> WHEN 50001 THEN
> SET @v1 = 10;
> END
Is this exception also known in the calling app.
In other words can I in the exception handler of Realbasic display a
dialog that says 'Some user error' when I 'raise 50001, 'Some user
error' inside the stored procedure.
The idea is when I get an invalid login I raise a user error 'Invalid
Login' that needs to be displayed inside the frontend (calling)
application.
Do I understand correctly that statements following the raise are NOT
executed. So raise can be considered the same as EXIT ?
TIA
Bart
More information about the Valentina
mailing list