Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Why prefix variables names with a colon?

Jon80Jun 24 2012 — edited Jun 24 2012
PROCEDURE 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
This post has been answered by Frank Kulash on Jun 24 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2012
Added on Jun 24 2012
10 comments
6,079 views