Why prefix variables names with a colon?
Jon80Jun 24 2012 — edited Jun 24 2012PROCEDURE calc_avg_sales
BEGIN
:sales.avg := :sales.month1 / :sales.total;
EXCEPTION WHEN ZERO_DIVIDE THEN
:sales_avg := 0;
RAISE FORM_TRIGGER_FAILURE;
WHEN OTHERS THEN NULL;
END;
Excerpt from Oracle PL/SQL Programming ISBN 0-596-00381-1 Pg. 106
Why are the variable :sales.avg, :sales.month1, and, :sales.total not declared in the above snippet? Is it presumed that they have been? Why is a : (colon) placed in front of the variables?
Why would you think that FORM_TRIGGER_FAILURE is raised rather than ZERO_DIVIDE?
Within my production environment I have noticed that error messages are sometimes vague to the user and for the technical user, and, would like to make use of an error table which would help technical support troubleshoot the cause of the error, without giving unnecessary details to the end user. Ideally this would include details of the Java Exceptions raised (usually large stacks) within applications that form part of the software architecture. How would you go about using an error handling mechanism?
Edited by: Jon80 on Jun 24, 2012 2:02 PM