Summary
In this chapter, we have covered the main issues surrounding external procedures such as:
-
Maintaining a state using contexts.
-
Using the OS-independent file APIs.
-
Making our external procedure code parameterized using external parameter files.
-
How to instrument our code (using debugf) to allow for ‘debugging from afar’.
-
How to code defensively (always pass the context, always pass the Null indicators, and so on).
-
How to use a generic template to get your external procedures ‘jump started’ quickly, with lots of functionality.
-
The differences between a pure OCI external procedure and one that uses Pro*C.
-
How to map and pass the relevant PL/SQL data types to and from C.
-
How to pass collections of data back and forth as well.
Given the generic template and makefiles above, you have all you need to write an external procedure from start to finish in a couple of minutes now. The tricky part is mapping the datatypes and the tables above, but that is easily accomplished by following the two tables in The Wrapper section - they tell you ‘given this type, you will use that type’. Then, just follow the guidelines I have for passing the parameters in the example above (always send the context, always send the MAXLEN attribute for strings and raws, always send the Null indicator, and so on). If you do that, you’ll be writing external procedures in no time.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2005 Thomas Kyte
About this chapter
Cite this chapter
(2005). C-Based External Procedures. In: Expert Oracle. A-Press. https://doi.org/10.1007/978-1-4302-0019-2_20
Download citation
DOI: https://doi.org/10.1007/978-1-4302-0019-2_20
Publisher Name: A-Press
Print ISBN: 978-1-59059-525-1
Online ISBN: 978-1-4302-0019-2
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books