Skip to main content

C-Based External Procedures

  • Chapter
Expert Oracle
  • 575 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 44.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Rights and permissions

Reprints 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

Publish with us

Policies and ethics