Writing the Call Specification
An external procedure can serve as the implementation of any program unit other than an anonymous block. In other words, a call specification can appear in a top-level procedure or function, a packaged procedure or function, or an object method. What’s more, you can define the call spec in either the specification or the body of packaged program units (or in either the spec or body of object types). Here are some schematic examples:
CREATE FUNCTIONname(args) RETURNdatatypeAScallspec;
You should recognize the form shown here as that of the shell( ) function shown earlier in the chapter. You can also create a procedure:
CREATE PROCEDUREnameAScallspec;
In this case, the corresponding C function would be typed void.
The next form shows a packaged function that does not need a package body:
CREATE PACKAGEpkgnameAS FUNCTIONnameRETURNdatatypeAScallspec; END;
However, when the time comes to modify the package, you would have to recompile the specification. Depending on the change you need to make, you may considerably reduce the recompilation ripple effect by moving the call spec into the package body:
CREATE PACKAGEpkgnameAS PROCEDUREname; END; CREATE PACKAGE BODYpkgnameAS PROCEDUREnameAScallspec; END;
Unpublished or private program units inside packages can also be implemented as external procedures. And finally, using a call spec in an object type method is quite similar to using it in a package; that is, you can put the call spec in the object ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access