Infolinks

Saturday 21 July 2012

srw-program_abort

Description  This exception stops the report execution and raises the following error message:
REP-1419: PL/SQL program aborted.
SRW.PROGRAM_ABORT stops report execution when you raise it.
Syntax           SRW.PROGRAM_ABORT;
Usage Notes  You must raise the exception from within your PL/SQL.
Example
/* Suppose you want to put a border around the salary if it is greater than 0.
** Suppose, also, that if the report fetches a salary less than 0, you want to
** raise a customized error message (i.e., “FOUND A NEGATIVE SALARY. . .”),
** then terminate the report execution.  To do so, you could write the
** following format trigger for F_SAL.
*/
FUNCTION foo return boolean is
BEGIN
if :sal >= 0 then
   srw.attr.mask         := SRW.BORDERWIDTH_ATTR;
   srw.attr.borderwidth  := 1;
   srw.set_attr (0, srw.attr);
else
   srw.message(100, ‘FOUND A NEGATIVE SALARY.
   CHECK THE EMP TABLE.’);
   raise srw.program_abort;
end if;
RETURN (TRUE);
END;

No comments:

Post a Comment