Skip to main content

Posts

Showing posts with the label api

When Lazy is Good: Overloading and APIs

When more than one subprogram (procedure or function) in the same scope share the same name, the subprograms are said to be overloaded. PL/SQL supports the overloading of procedures and functions in the declaration section of a block (named or anonymous), package specifications and bodies, and object type definitions. Overloading is a very powerful feature, and you should exploit it fully to improve the usability of your software. Before exploring some of the details of overloading, a short quiz: Which of the following is another name for overloading? Dynamic Polymorphism Interface Inheritance Static Polymorphism Multiple Monomorphism In a poll I conducted on Twitter , we saw the following results: And I was very glad to see this, because Static Polymorphism is, indeed, another name for overloading, and here's why: With overloading, at the time your code is compiled, PL/SQL resolves all references to named elements, such as a function invocation. If there is more ...

Smoothing rough edges for productive programming

No language is perfect and while PL/SQL is an incredibly "tight fit" for building applications on top of Oracle SQL (and, of course, Oracle Database), it also is not yet quite perfect . Maybe in Oracle Database 13(?) - (?) being whichever letter Larry decides will best reflect the main theme of that version.... In any case, in the meantime, and to paraphrase a saying: You write code with the language you've got, not the language you want. So the key thing is to maximize your productivity any way you can, all along the way. And sometimes the steps you can and should take in this area can be very small, but they can still add up. Case in point: displaying a Boolean value with DBMS_OUTPUT.PUT_LINE. As anyone who's spent time with PL/SQL knows, DBMS_OUTPUT.PUT_LINE is the procedure provided by Oracle to display text from within a PL/SQL block on your screen. It accepts a string (and anything that can be implicitly converted to a string) and sends it to the ...