Skip Headers

Oracle® SQL*Module for Ada Programmer's Guide
Release 8.0

Part Number A58231-03
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Master Index
Master Index
Go to Feedback page

Go to previous page
Go to next page
View PDF


This book is a comprehensive user's guide and reference for SQL*Module, an Oracle application development tool.

This Guide includes a complete description of Module Language, an ANSI/ISO SQL standard for developing applications that access data stored in a relational database. Module Language uses parameterized procedures to encapsulate SQL statements. The procedures can then be called from an Ada application.

This Guide also describes how you can use SQL*Module to call PL/SQL procedures stored in an Oracle database. A number of complete examples using Module Language, Ada code, and stored database procedures are provided.

This Preface contains these topics:

Intended Audience

Oracle SQL*Module for Ada Programmer's Guide is intended for systems architects, analysts, and developers who are writing large-scale applications that access an Oracle Server. Chapter 1 of this Guide can also be used by managers who need to determine if SQL*Module is an appropriate tool for a planned project.

To use this Guide effectively, you need a working knowledge of the following topics:

Familiarity with SQL-standard Module Language is not a prerequisite. This Guide fully documents Module Language.

Documentation Accessibility

Our goal is to make Oracle products, services, and supporting documentation accessible, with good usability, to the disabled community. To that end, our documentation includes features that make information available to users of assistive technology. This documentation is available in HTML format, and contains markup to facilitate access by the disabled community. Standards will continue to evolve over time, and Oracle is actively engaged with other market-leading technology vendors to address technical obstacles so that our documentation can be accessible to all of our customers. For additional information, visit the Oracle Accessibility Program Web site at
Accessibility of Code Examples in Documentation

JAWS, a Windows screen reader, may not always correctly read the code examples in this document. The conventions for writing code require that closing braces should appear on an otherwise empty line; however, JAWS may not always read a line of text that consists solely of a bracket or brace.

Accessibility of Links to External Web Sites in Documentation

This documentation may contain links to Web sites of other companies or organizations that Oracle does not own or control. Oracle neither evaluates nor makes any representations regarding the accessibility of these Web sites.

Standards Conformance

SQL*Module conforms to the American National Standards Institute (ANSI) and International Standards Organization (ISO) standards for Module Language. This includes complete conformance with Chapter 7 of ANSI document X3.135-1989, Database Language SQL with Integrity Enhancement.

In addition, SQL*Module conforms to the "Entry SQL" subset of the SQL92 standard, as defined in Chapter 12 of the ANSI Document X3.135-1992.

Note: SQL92 is known officially as International Standard ISO/IEC 9075:1992, Database Language SQL.

SQL*Module supports the Ada83 language standard for Ada.

Oracle has also implemented extensions to the SQL language and to Module Language. This Guide describes both the SQL standard Module Language and the complete set of Oracle extensions. SQL*Module provides an option, called the FIPS flagger, which flags all non-standard extensions to SQL and to Module Language, as mandated by the Federal Information Processing Standard for Database Language SQL, FIPS publication 127-1. This publication is available from

National Technical Information Service US Department of Commerce Springfield VA 22161 U.S.A


This document contains:

Chapter 1, " Introduction to SQL*Module"

This chapter introduces you to Oracle's Module Language compiler. You learn what SQL*Module is, when it is appropriate to use SQL*Module for a project, and what features the SQL*Module compiler offers. The chapter also provides an overview showing how to develop an application using SQL*Module.

Chapter 2, " Module Language"

This chapter documents SQL standard Module Language, and also describes the Oracle extensions to the Module Language standard.

Chapter 3, " Accessing Stored Procedures"

This chapter describes how to use SQL*Module to generate code output files that contain interface procedures (stubs) used to call PL/SQL procedures stored in an Oracle database.

Chapter 4, " Developing the Ada Application"

This chapter describes the steps you take to develop an application using SQL*Module. This chapter also includes a sample application in Module Language. The Module Language code and the SQL scripts that build the sample database are listed; they are also available on-line, in the demo directory.

Chapter 5, " Running SQL*Module"

This chapter tells you how to invoke SQL*Module, what input and output files are required and are generated, and describes all the command-line options.

Chapter 6, " Demonstration Programs"

This chapter describes Ada-specific aspects of using SQL*Module, including parameter passing conventions and binding of Ada datatypes to SQL datatypes. This chapter also contains several sample programs that call stored procedures and Module Language procedures.

Appendix A, " New Features"

This appendix provides lists of new statements and other new features in release 8.0.

Appendix B, " Module Language Syntax"

This appendix presents the formal syntax of Module Language using syntax diagrams.

Appendix C, " Reserved Words"

This appendix lists the keywords and reserved words that you cannot use for names of modules, cursors, procedures, and procedure parameters in a Module Language application.

Appendix D, " SQLSTATE Codes"

This appendix contains a table of the SQLSTATE codes.

Appendix E, " System-Specific References"

This appendix contains a list of all system-dependent aspects of SQL*Module for Ada that are mentioned elsewhere in this guide.

Related Documents

Printed documentation is available for sale in the Oracle Store at

To download free release notes, installation documentation, white papers, or other collateral, please visit the Oracle Technology Network (OTN). You must register online before using OTN; registration is free and can be done at

If you already have a username and password for OTN, then you can go directly to the documentation section of the OTN Web site at


This section describes the conventions used in the text and code examples of this documentation set. It describes:

Conventions in Text

The style of the Ada Language Reference Manual is generally followed: reserved words are lowercase, identifiers are uppercase. In running text, reserved words are bold and identifiers are uppercase. Filenames are lowercase.

Additionally, we use various conventions in text to help you more quickly identify special terms. The following table describes those conventions and provides examples of their use.

Convention Meaning Example
Bold Bold typeface indicates terms that are defined in the text or terms that appear in a glossary, or both. When you specify this clause, you create an index-organized table.
Italics Italic typeface indicates book titles or emphasis. Oracle Database Concepts

Ensure that the recovery catalog and target database do not reside on the same disk.

UPPERCASE monospace (fixed-width) font Uppercase monospace typeface indicates elements supplied by the system. Such elements include parameters, privileges, datatypes, RMAN keywords, SQL keywords, SQL*Plus or utility commands, packages and methods, as well as system-supplied column names, database objects and structures, usernames, and roles. You can specify this clause only for a NUMBER column.

You can back up the database by using the BACKUP command.

Query the TABLE_NAME column in the USER_TABLES data dictionary view.


lowercase monospace (fixed-width) font Lowercase monospace typeface indicates executables, filenames, directory names, and sample user-supplied elements. Such elements include computer and database names, net service names, and connect identifiers, as well as user-supplied database objects and structures, column names, packages and classes, usernames and roles, program units, and parameter values.

Note: Some programmatic elements use a mixture of UPPERCASE and lowercase. Enter these elements as shown.

Enter sqlplus to start SQL*Plus.

The password is specified in the orapwd file.

Back up the datafiles and control files in the /disk1/oracle/dbs directory.

The department_id, department_name, and location_id columns are in the hr.departments table.

Set the QUERY_REWRITE_ENABLED initialization parameter to true.

Connect as oe user.

The JRepUtil class implements these methods.

lowercase italic monospace (fixed-width) font Lowercase italic monospace font represents placeholders or variables. You can specify the parallel_clause.

Run old_release.SQL where old_release refers to the release you installed prior to upgrading.

Conventions in Code Examples

Code examples illustrate SQL, PL/SQL, SQL*Plus, or other command-line statements. They are displayed in a monospace (fixed-width) font and separated from normal text as shown in this example:

SELECT username FROM dba_users WHERE username = 'MIGRATE';

The following table describes typographic conventions used in code examples and provides examples of their use.

Convention Meaning Example
[ ]
Brackets enclose one or more optional items. Do not enter the brackets.
DECIMAL (digits [ , precision ])
{ }
Braces enclose two or more items, one of which is required. Do not enter the braces.

A vertical bar represents a choice of two or more options within brackets or braces. Enter one of the options. Do not enter the vertical bar.
Horizontal ellipsis points indicate either:
  • That we have omitted parts of the code that are not directly related to the example

  • That you can repeat a portion of the code

CREATE TABLE ... AS subquery;

SELECT col1, col2, ... , coln FROM employees;
Vertical ellipsis points indicate that we have omitted several lines of code not directly related to the example.
9 rows selected.
Other notation You must enter symbols other than brackets, braces, vertical bars, and ellipsis points as shown.
acctbal NUMBER(11,2);
acct    CONSTANT NUMBER(4) := 3;
Italicized text indicates placeholders or variables for which you must supply particular values.
CONNECT SYSTEM/system_password
DB_NAME = database_name
Uppercase typeface indicates elements supplied by the system. We show these terms in uppercase in order to distinguish them from terms you define. Unless terms appear in brackets, enter them in the order and with the spelling shown. However, because these terms are not case sensitive, you can enter them in lowercase.
SELECT last_name, employee_id FROM employees;
DROP TABLE hr.employees;
Lowercase typeface indicates programmatic elements that you supply. For example, lowercase indicates names of tables, columns, or files.

Note: Some programmatic elements use a mixture of UPPERCASE and lowercase. Enter these elements as shown.

SELECT last_name, employee_id FROM employees;
sqlplus hr/hr