Databases Reference
In-Depth Information
FOR cur IN (SELECT book id
FROM fm bookings
WHERE book res id = l res id
AND book booked from > SYSDATE)
LOOP
fm booking.cancel booking (p book id => cur.book id);
END LOOP;
END;
In order to achieve a high degree of consistency we have learned not only to create standards for
purely syntactical concerns but also for the semantics. If you look at all your projects you have
previously worked in, was your use of procedure and function names consistent at all times?
For creating a new object of any sort, you will find procedures or functions with names like add,
create, insert, or new. The same is true for the removal (remove, delete) or the modification (modify,
update, change, set). Thus we have standardized the naming of operations as well as the naming of table
columns in order to enforce a consistent usage.
The CRUD convention ( C reate, R etrieve, U pdate, D elete) is well known in the database community
for specifying privileges in order to access data. We chose to use GET instead of RETRIEVE, as it
appeared more natural to us since it is commonly used in many application programming languages.
Thus for naming procedures and functions we have agreed on the so called CGUD convention :
C : create
G : get
U : update
D : delete
One example for implementing this convention is shown in Figure 9-9.
Figure 9-9. Naming procedures and functions
We also tend to separate the operations on the back-end data model from the front-end application
technology. In the example in Figure 9-9 the package FM BOOKING implements the operations on the data
model which are not related to any specific front-end application technology. These operations can be
used by any programming environment, such as PL/SQL, Oracle Forms, Java, C++, and .Net.
Aside from that you will always need operations that are specific to the front-end technology, which
might even need the specific application context to work properly (e.g., current session context in a web
environment). In our APEX applications, we implement certain validations (which use session variables
Search WWH ::




Custom Search