Subject | Re: IF and only IF |
---|---|
Author | Adam |
Post date | 2006-02-04T09:21:34Z |
--- In firebird-support@yahoogroups.com, "Alberto Pesce"
<palberto@...> wrote:
execute get_number('P', 2006);
Insert into table ( ) values( );
execute set_number('P', 2006);
If any of the statements raise an exception, and the stored procedure
doesn't swallow the exception, then the exception will be returned to
the calling program and any actions undertaken by the stored procedure
will be undone.
By the way, this is very easy to test. Simply raise an exception in a
before or after insert trigger, then call this procedure and you will
see that set_number is not run.
Adam
<palberto@...> wrote:
>Inside a PSQL block, you can do something like this:
> I need to make this:
>
> execute get_number('P', 2006)
>
> Insert into table ( ) values( )
>
> if and only if Inserted values in table {
>
> execute set_number('P', 2006)
>
> }
> else
> exception ....
>
>
> How can I do this. note this is storeprocedure-like
>
execute get_number('P', 2006);
Insert into table ( ) values( );
execute set_number('P', 2006);
If any of the statements raise an exception, and the stored procedure
doesn't swallow the exception, then the exception will be returned to
the calling program and any actions undertaken by the stored procedure
will be undone.
By the way, this is very easy to test. Simply raise an exception in a
before or after insert trigger, then call this procedure and you will
see that set_number is not run.
Adam