Subject Re: [ib-support] Re: Handling errors in triggers
Author John Bellardo
On Thursday, August 2, 2001, at 09:13 AM, Alexander V.Nevsky wrote:

> --- In ib-support@y..., trans-x@a... wrote:
>> Is it possible to handle errors (WHEN SQLCODE - 803 DO...) in
>> triggers or can that only be used in stored procedures?
>
> Hi, Magnus. Why not? Trigger is especial kind of SP. There is only 2
> limitations - trigger have'nt input-output parameters and can't
> contain explicitly planned SQL statements. Why last - I don't know,
> maybe because sequence of restore process.

On why plans aren't allowed in triggers (from the source in
dsql/pass1.c):

/* parse a user-specified access plan */

if (node = input->nod_arg [e_sel_plan])
{
---> /* disallow plans in a trigger for the short term,
---> until we can figure out why they don't work: bug #6057 */

if (request->req_flags & REQ_trigger)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, gds__token_err, /* Token unknown */
gds_arg_gds, gds__random,
gds_arg_string, "PLAN", 0);

rse->nod_arg [e_rse_plan] = PASS1_node (request, node, 0);
}


Note the comment that says there is a bug (#6057) somewhere that hasn't
been found yet.

-John