Skip Headers
Oracle® Database Programmer's Guide to the Oracle Precompilers
10g Release 2 (10.2)

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

Go to previous page
Previous
Go to next page
Next
View PDF

6 Running the Oracle Precompilers

This chapter contains the following:

This chapter details the requirements for running the Oracle Precompilers. You learn what occurs during precompilation, how to issue the precompiler command, how to specify the many useful precompiler options, and how to do conditional and separate precompilations.

6.1 The Precompiler Command

To run an Oracle Precompiler, you issue one of the language-specific commands shown in Table 6-1.

Table 6-1 Precompiler Command

Host Language Precompiler Command
COBOL procob
FORTRAN profor

The location of the precompiler differs from system to system. Typically, your system manager or DBA defines environment variables, logicals, or aliases or uses other operating system-specific means to make the precompiler executable accessible.

The INAME option specifies the source file to be precompiled. For example, the Pro*COBOL command

procob INAME=test

precompiles the file test.pco in the current directory, since the precompiler assumes that the filename extension is .pco. You need not use a file extension when specifying INAME unless the extension is nonstandard.

Input and output filenames need not be accompanied by their respective option names, INAME and ONAME. When the option names are not specified, the precompiler assumes that the first filename specified on the command line is the input filename and that the second filename is the output filename.

Thus, the Pro*FORTRAN command

profor MODE=ANSI myfile.pfo DBMS=V7 myfile.f

is equivalent to

profor MODE=ANSI INAME=myfile.pfo DBMS=V7 ONAME=myfile.f


Note:

Option names and option values that do not name specific operating system objects, such as filenames, are not case-sensitive. In the examples in this guide, option names are written in upper case, and option values are usually in lower case. Filenames, including the name of the precompiler executable itself, always follow the case conventions used by the operating system on which it is executed.

6.2 What Occurs during Precompilation?

During precompilation, an Oracle Precompiler generates host-language code that replaces the SQL statements embedded in your host program. The generated code includes data structures that contain the datatype, length, and address of each host variable, as well as other information required by the Oracle runtime library, SQLLIB. The generated code also contains the calls to SQLLIB routines that perform the embedded SQL operations.

The generated code also includes calls to the SQLLIB routines that perform embedded SQL operations. Note that the precompiler does not generate calls to Oracle Call Interface (OCI) routines.

The precompiler does not generate calls to Oracle Call Interface (OCI) routines.

The precompiler can issue warnings and error messages. These messages have the prefix PCC-, and are described in Oracle database version 7 Server Messages.

6.3 Precompiler Options

Many useful options are available at precompile time. They let you control how resources are used, how errors are reported, how input and output are formatted, and how cursors are managed. To specify a precompiler option, use the following syntax:

<option_name>=<value>

The value of an option is a string literal, which represents text or numeric values. For example, for the option

... INAME=my_test

the value is a string literal that specifies a filename, but for the option

... MAXOPENCURSORS=20

the value is numeric.

Some options take Boolean values, which you can represent with the strings YES or NO, TRUE or FALSE, or with the integer literals 1 or 0, respectively. For example, the option

... SELECT_ERROR=YES

is equivalent to

... SELECT_ERROR=TRUE

or

... SELECT_ERROR=1

The option value is always separated from the option name by an equal sign, leave no whitespace around the equal sign, because spaces delimit individual options. For example, you might specify the option AUTO_CONNECT on the command line as follows:

... AUTO_CONNECT=YES

You can abbreviate the names of options if the abbreviation is unambiguous. For example, you cannot use the abbreviation MAX because it might stand for MAXLITERAL or MAXOPENCURSORS.

A handy reference to the precompiler options is available online. To see the online display, enter the precompiler command with no arguments at your operating system prompt. The display gives the name, syntax, default value, and purpose of each option. Options marked with an asterisk (*) can be specified inline as well as on the command line.

6.3.1 Default Values

Many of the options have default values, which are determined by:

  • A value built in to the precompiler

  • A value set in the system configuration file

  • A value set in a user configuration file

  • A value set in an inline specification

For example, the option MAXOPENCURSORS specifies the maximum number of cached open cursors. The built-in precompiler default value for this option is 10. However, if MAXOPENCURSORS=32 is specified in the system configuration file, the default becomes 32. The user configuration file could set it to yet another value, which then overrides the system configuration value.

Then, if this option is set on the command line, the new command-line value takes precedence. Finally, an inline specification takes precedence over all preceding defaults. For more information, refer to Configuration Files" .

6.3.2 Determining Current Values

You can interactively determine the current value for one or more options by using a question mark on the command line. For example, if you issue the Pro*COBOL command

procob ?

the complete option set, along with current values, is displayed on your terminal. In this case, the values are those built into the precompiler, overridden by any values in the system configuration file. But if you issue the following command

procob CONFIG=my_config_file.cfg ?

and there is a file named my_config_file.cfg in the current directory, the options from the my_config_file.cfg file are listed with the other default values. Values in the user configuration file supply missing values, and they supersede values built into the precompiler or values specified in the system configuration file.

You can also determine the current value of a single option by simply specifying the option name followed by "=?" as in

procob MAXOPENCURSORS=?


Note:

: With some operating systems, the "?" may need to be preceded by an "escape" character, such as a back-slash (\). For example, instead of "procob ?," you might need to use "procob \?" to list the Pro*COBOL option settings.

6.3.3 Case Sensitivity

In general, you can use either uppercase or lowercase for command-line option names and values. However, if your operating system is case-sensitive, like UNIX, you must specify filename values, including the name of the precompiler executable, using the correct combination of upper and lowercase letters.

6.3.4 Configuration Files

A configuration file is a text file that contains precompiler options. Each record (line) in the file contains one option, with its associated value or values. For example, a configuration file might contain the lines

FIPS=YES
MODE=ANSI

to set defaults for the FIPS and MODE options.

There is a single system configuration file for each system. The name of the system configuration file is precompiler-specific and is shown in Table 6-2.

Table 6-2 System Configuration File

Precompiler Configuration File
Pro*COBOL pcccob.cfg
Pro*FORTRAN pccfor.cfg

The location of the file is operating system-specific. On most UNIX systems, the Pro*COBOL configuration file is usually located in the $ORACLE_HOME/procob directory, and the Pro*FORTRAN equivalent is in the $ORACLE_HOME/profor directory, where $ORACLE_HOME is the environment variable for the database software.

Each precompiler user can have one or more user configuration files. The name of the configuration file must be specified using the CONFIG command-line option. For more information, refer to Determining Current Values.


Note:

You cannot nest configuration files. This means that CONFIG is not a valid option inside a configuration file.

6.4 Entering Options

All the precompiler options can be entered on the command line or (except CONFIG) from a configuration file. Many options can also be entered inline. During a given run, the precompiler can accept options from all three sources.

6.4.1 On the Command Line

You enter precompiler options on the command line using the following syntax:

... [option_name=value] [option_name=value] ...

Separate each option with one or more spaces. For example, you might enter the following options:

... ERRORS=no LTYPE=short

6.4.2 Inline

You enter options inline by coding EXEC ORACLE statements, using the following syntax:

EXEC ORACLE OPTION (option_name=value);

For example, you might code the following statement:

EXEC ORACLE OPTION (RELEASE_CURSOR=YES);

An option entered inline overrides the same option entered on the command line.

6.4.3 Advantages

The EXEC ORACLE feature is especially useful for changing option values during precompilation. For example, you might want to change the HOLD_CURSOR and RELEASE_CURSOR values on a statement-by-statement basis. Appendix C shows you how to use inline options to optimize runtime performance.

Specifying options inline is also helpful if your operating system limits the number of characters you can enter on the command line, and you can store inline options in configuration files, which are discussed in the next section.

6.4.4 Scope of EXEC ORACLE

An EXEC ORACLE statement stays in effect until textually superseded by another EXEC ORACLE statement specifying the same option. In the following example, HOLD_CURSOR=NO stays in effect until superseded by HOLD_CURSOR=YES:

EXEC SQL BEGIN DECLARE SECTION;
 emp_name CHARACTER(20);
 emp_number INTEGER;
 salary REAL;
 dept_number INTEGER;
EXEC SQL END DECLARE SECTION;
...
EXEC SQL WHENEVER NOT FOUND GOTO no_more;
EXEC ORACLE OPTION (HOLD_CURSOR=NO);
EXEC SQL DECLARE emp_cursor CURSOR FOR
 SELECT EMPNO, DEPTNO FROM EMP;
EXEC SQL OPEN emp_cursor;
display 'Employee Number Dept';
display '--------------- ----';
LOOP
 EXEC SQL FETCH emp_cursor INTO :emp_number, :dept_number; 
 display emp_number, dept_number;
ENDLOOP;
no_more:
 EXEC SQL WHENEVER NOT FOUND CONTINUE; 
 LOOP
 display 'Employee number? ';
 read emp_number;
 IF emp_number = 0 THEN
 exit loop;
 EXEC ORACLE OPTION (HOLD_CURSOR=YES);
 EXEC SQL SELECT ENAME, SAL
 INTO :emp_name, :salary
 FROM EMP
 WHERE EMPNO = :emp_number; 
 display 'Salary for ', emp_name, ' is ', salary;
 ENDLOOP;
...

6.4.5 From a Configuration File

The Oracle Precompilers can use a configuration file containing preset command-line options. By default, a text file called the system configuration file is used. However, you can specify any of several alternative files, called user configuration files, on the command line.

6.4.6 Advantages

Configuration files offer several advantages. The system configuration file lets you standardize a set of options for all projects. User configuration files let you customize a set of options for each project. With configuration files, you need not enter long strings of options on the command line. Also, if your system limits the length of a command line, configuration files let you specify more options than the command line can hold.

6.4.7 Using Configuration Files

Each record (line) in a configuration file holds one command-line option. For example, a configuration file might contain the following lines, which set defaults for the FIPS, MODE, and SQLCHECK options:

FIPS=YES
MODE=ANSI
SQLCHECK=SEMANTICS

Each Oracle Precompiler can have its own system configuration file. The name and location of the file are language- and system-specific. If the file is not found, you get a warning but the precompiler continues processing.

There is only one system configuration file for a given language, but you can create any number of user configuration files. You use the new command-line option CONFIG to specify the name and location of a particular user configuration file, as follows:

... CONFIG=<filename>

You cannot nest configuration files. Therefore, you cannot specify the CONFIG option in a configuration file. Also, you cannot specify CONFIG inline.

6.4.8 Setting Option Values

Many precompiler runtime options have built-in default values, which can be reset in a configuration file or on the command line. Command-line settings override user configuration file settings, which override system configuration file settings.

6.5 Scope of Options

A precompilation unit is a file containing host-language code and one or more embedded SQL statements. The options specified for a given precompilation unit affect only that unit; they have no effect on other units.

For example, if you specify HOLD_CURSOR=YES and RELEASE_CURSOR=YES for unit A but not unit B, SQL statements in unit A run with these HOLD_CURSOR and RELEASE_CURSOR values, but SQL statements in unit B run with the default values. However, the MAXOPENCURSORS setting that is in effect when you connect to Oracle stays in effect for the life of that connection.

The scope of an inline option is positional, not logical. That is, an inline option affects SQL statements that follow it in the source file, not in the flow of program logic. An option setting stays in effect until the end-of-file unless you respecify the option.

6.6 Quick Reference

Table 6-3 is a quick reference to the precompiler options. Options marked with an asterisk can be entered inline.

Another handy reference is available online. To see the online display, just enter the precompiler command without options at your operating system prompt. The display gives the name, syntax, default value, and purpose of each option.

There are some platform-specific options. For example, on byte-swapped platforms that use MicroFocus COBOL, the option COMP5 governs the use of certain COMPUTATIONAL items. Check your system-specific Oracle manuals.

Table 6-3 Precompiler Options

Syntax Default Specifies ...
Syntax Default Specifies ...
ASACC={YES|NO} NO carriage control for listing
ASSUME_SQLCODE={YES|NO} NO precompiler presumes that SQLCODE is declared
AUTO_CONNECT={YES|NO} NO automatic logon
CONFIG=filename
name of user configuration file
COMMON_NAME=block_name *
name of FORTRAN COMMON blocks
DBMS={NATIVE|V6|V7} NATIVE version-specific behavior of Oracle at precompile time
DEFINE=symbol *
symbol used in conditional precompilation
ERRORS={YES|NO} * YES whether errors are sent to the terminal
FIPS={YES|NO}* NO whether ANSI/ISO extensions are flagged
FORMAT={ANSI|TERMINAL} ANSI format of COBOL or FORTRAN input line
HOLD_CURSOR={YES|NO}* NO how cursor cache handles SQL statements
HOST={COBOL|COB74} COBOL COBOL version of input file
[INAME=]filename
name of input file
INCLUDE=path*
directory path for INCLUDEd files
IRECLEN=integer 80 record length of input file
LITDELIM={APOST|QUOTE} * QUOTE delimiter for COBOL strings
LNAME=filename
name of listing file
LRECLEN=integer 132 record length of listing file
LTYPE={LONG|SHORT|NONE} LONG type of listing
MAXLITERAL=integer * platform-specific maximum length of strings
MAXOPENCURSORS=integer * 10 maximum number of cursors cached
MODE={ORACLE|ANSI|ANSI14|ANSI13} ORACLE compliance with the ANSI/ISO SQL standard
MULTISUBPROG={YES|NO} YES whether FORTRAN COMMON blocks are generated
Globalization Support_LOCAL={YES|NO} YES blank-padding operations to be preformed by SQLLIB
[ONAME=]filename
name of output file
ORACA={YES|NO}* NO whether the ORACA is used
ORECLEN=integer 80 record length of output file
PAGELEN=integer 66 lines in each page in listing
RELEASE_CURSOR={YES|NO} * NO how cursor cache handles SQL statements
SELECT_ERROR={YES|NO}* YES how SELECT errors are handled
SQLCHECK={FULL|SYNTAX|LIMITED|NONE}* SYNTAX extent of syntactic and semantic checking
UNSAFE_NULL={YES|NO} NO disables the ORA-01405 message
USERID=username/password
valid Oracle username and password
VARCHAR={YES|NO} NO recognize implicit VARCHAR group items in COBOL
XREF={YES|NO}* YES cross reference section in listing

6.7 Using the Precompiler Options

This section is organized for easy reference. It lists the precompiler options alphabetically, and for each option gives its purpose, syntax, and default value. Usage notes that help you understand how the option works are also provided. Unless the usage notes say otherwise, the option can be entered on the command line, inline, or from a configuration file.

6.7.1 ASACC

Purpose

Specifies whether the listing file follows the ASA convention of using the first column in each line for carriage control.

Syntax

ASACC={YES|NO}

Default

NO

Usage Notes

Cannot be entered inline.

6.7.2 ASSUME_SQLCODE

Purpose

Instructs the Oracle Precompiler to presume that SQLCODE is declared whether or not it is declared in the Declare Section or of the proper type. ASSUME_SQLCODE=YES causes Releases 1.6 and later of the Oracle Precompilers to behave similarly to Release 1.5 in this respect.

Syntax

ASSUME_SQLCODE={YES|NO}

Default

NO

Usage Notes

Cannot be entered inline.

When ASSUME_SQLCODE=NO, SQLCODE is recognized as a status variable if and only if at least one of the following criteria is satisfied:

  • It is declared in a Declare Section with exactly the right datatype.

  • The precompiler finds no other status variable.

If the precompiler finds a SQLSTATE declaration (of exactly the right type of course) in a Declare Section or finds an INCLUDE of the SQLCA, it will not presume SQLCODE is declared.

When ASSUME_SQLCODE=YES, and when SQLSTATE and SQLCA (Pro*FORTRAN only) are declared as status variables, the precompiler presumes SQLCODE is declared whether or not it is declared in a Declare Section or of the proper type. This causes Releases 1.6.7 and later to behave like Release 1.5 in this regard.

6.7.3 AUTO_CONNECT

Purpose

Specifies whether your program connects automatically to the default user account.

Syntax

AUTO_CONNECT={YES|NO}

Default

NO

Usage Notes

Cannot be entered inline.

When AUTO_CONNECT=YES, as soon as the precompiler encounters an executable SQL statement, your program tries to log on to Oracle automatically with the userid

<prefix><username>

where prefix is the value of the Oracle initialization parameter OS_AUTHENT_PREFIX (the default value is null) and username is your operating system user or task name. In this case, you cannot override the default value for MAXOPENCURORS (10), even if you specify a different value on the command line.

When AUTO_CONNECT=NO (the default), you must use the CONNECT statement to log on to Oracle.

6.7.4 COMMON_NAME

Purpose

For Pro*FORTRAN only, the COMMON_NAME option specifies a prefix used to name internal FORTRAN COMMON blocks. Your host program does not access the COMMON blocks directly. But, they allow two or more program units in the same precompilation unit to contain SQL statements.

Syntax

COMMON_NAME=blockname

Default

First five characters in name of input file

Usage Notes

The Pro*FORTRAN Precompiler uses a special program file called a block data subprogram to establish COMMON blocks for all the SQL variables in an input file. The block data subprogram defines two COMMON blocks -- one for CHARACTER variables, the other for non-CHARACTER variables -- and uses DATA statements to initialize the variables.

The format of a block data subprogram follows:

BLOCK DATA <subprogram_name>
variable declarations
COMMON statements
DATA statements
END

Your host program does not access the COMMON blocks directly. But, they allow two or more program files in the same precompilation file to contain SQL statements.

To name the COMMON blocks, the precompiler uses the name of the input file and the suffixes C, D, and I. At most, the first five characters of the filename are used. For example, if the name of the input file is ACCTSPAY, the precompiler names the COMMON blocks ACCTSC, ACCTSD, and ACCTSI.

The precompiler, however, can give COMMON blocks defined in different output files the same name, as the following schematic shows:

ACCTSPAY.PFO ===> ACCTSC, ACCTSD, ACCTSI in ACCTSPAY.FOR
ACCTSREC.PFO ===> ACCTSC, ACCTSD, ACCTSI in ACCTSREC.FOR

If you were to link ACCTSPAY and ACCTSREC into an executable program, the linker would see three, not six, COMMON blocks.

To solve the problem, you can rename the input files, or you can override the default COMMON block names by specifying COMMON_NAME inline or on the command line as follows:

COMMON_NAME=<block_name>

where block_name is a legal COMMON block name. For example, if you specify COMMON_NAME=PAY, the precompiler names its COMMON blocks PAYC and PAYI. At most, the first five characters in block_name are used.

For example, if you specify COMMON_NAME=PAY, the precompiler names its COMMON blocks PAYC and PAYI. At most, the first 5 characters in block_name are used.

If you specify COMMON_NAME inline, its EXEC ORACLE OPTION statement must precede the FORTRAN PROGRAM, SUBROUTINE, or FUNCTION statement.

You might want to override the default COMMON block names if they conflict with your user-defined COMMON block names. However, the preferred practice is to rename the user-defined COMMON blocks.

COMMON_NAME is not needed if you specify MULTISUBPROG.

6.7.5 CONFIG

Purpose

Specifies the name of a user configuration file.

Syntax

CONFIG=filename

Default

None

Usage Notes

Can be entered only on the command line.

The Oracle Precompilers can use a configuration file containing preset command-line options. By default, a text file called the system configuration file is used. However, you can specify any of several alternative files, called user configuration files. For more information, refer to Configuration Files.

You cannot nest configuration files. Therefore, you cannot specify the option CONFIG in a configuration file.

6.7.6 DBMS

Purpose

Specifies whether Oracle follows the semantic and syntactic rules of Oracle Version 6, Oracle database version 7, or the native version of Oracle (that is, the version to which your application is connected).

Syntax

DBMS={NATIVE|V6|V7}

Default

NATIVE

Usage Notes

Cannot be entered inline.

With the DBMS option you can control the version-specific behavior of Oracle. When DBMS=NATIVE (the default), Oracle follows the semantic and syntactic rules of the native version of Oracle.

When DBMS=V6 or DBMS=V7, Oracle follows the rules of Oracle Version 6 or Oracle database version 7, respectively. A summary of the differences between DBMS=V6 and DBMS=V7 follows:

  • When DBMS=V6, integrity constraints (except NOT NULL) are disabled. When DBMS=V7, however, all Oracle database version 7 integrity constraints are enabled.

  • When DBMS=V6, Oracle treats string literals like variable-length character values. However, when DBMS=V7, Oracle treats string literals like fixed-length character values, and CHAR semantics change slightly to comply with the current ANSI/ISO embedded SQL standard.

  • When DBMS=V6, Oracle treats local CHAR variables in a PL/SQL block like variable-length character values. When DBMS=V7, however, Oracle treats the CHAR variables like ANSI-compliant, fixed-length character values.

  • When DBMS=V6, Oracle treats the return value of the function USER like a variable-length character value. However, when DBMS=V7, Oracle treats the return value of USER like an ANSI-compliant, fixed-length character value.

  • When DBMS=V6, if you process a multi-row query that calls a SQL group function such as AVG or COUNT, the function is called when executing an OPEN statement. When DBMS=V7, however, the function is called when executing an FETCH statement. When OPENing or FETCHing, if the function call fails, Oracle issues an error message immediately. Thus, the DBMS value affects error reporting slightly.

  • When DBMS=V6, no error is returned if a SELECT or FETCH statement selects a null, and there is no indicator variable associated with the output host variable. When DBMS=V7, SELECTing or FETCHing a null column or expression into a host variable that has no associated indicator variable causes an error (SQLSTATE is "22002"; SQLCODE is ORA-01405).

  • When DBMS=V6, if you SELECT or FETCH a truncated column value into a host variable that lacks an indicator variable, Oracle generates error ORA-01406. When DBMS=V7, however, Oracle generates no error.

  • When DBMS=V6, a DESCRIBE operation of a fixed-length string (in Dynamic SQL Method 4) returns datatype code 1. When DBMS=V7, the DESCRIBE operation returns datatype code 96.

  • When DBMS=V6, PCTINCREASE is allowed for rollback segments. When DBMS=V7, however, PCTINCREASE is not allowed for rollback segments.

  • When DBMS=V6, illegal MAXEXTENTS storage parameters are allowed. When DBMS=V7, however, they are not allowed.

  • When DBMS=V6, constraints (except NOT NULL) are not enabled. When DBMS=V7, all Oracle database version 7 constraints are enabled.

  • When DBMS=V7, you cannot SELECT or FETCH nulls into a host variable not associated with an indicator variable.

If you precompile using the DBMS=V6 option, and connect to an Oracle database version 7 database, then a data definition language (DDL) statement such as

CREATE TABLE T1 (COL1 CHAR(10))

creates the table using the VARCHAR2 (variable-length) datatype, as if the CREATE TABLE statement had been

CREATE TABLE T1 (COL1 VARCHAR2(10))

Table 6-4 shows how the compatible DBMS and MODE settings interact. All other combinations are incompatible or unrecommended.

Table 6-4 DBMS and MODE Settings

Situation DBMS=V7 MODE=ANSI DBMS=V7 MODE=ORACLE DBMS=V6 MODE=ORACLE
"no data found" warning code +100 +1403 +1403
fetch nulls without using indicator variables error -1405 error -1405 no error
fetch truncated values without using indicator variables no error but SQLWARN(2) is set no error but SQLWARN(2) is set error -1406 and SQLWARN(2) is set
cursors closed by COMMIT or ROLLBACK all explicit CURRENT OF only CURRENT OF only (1)
open an already OPENed cursor error -2117 no error no error
close an already CLOSEd cursor error -2114 no error no error
SQL group function ignores nulls no warning no warning SQLWARN(3) is set
when SQL group function in multirow query is called FETCH time FETCH time OPEN time
declare SQLCA structure optional required required (2)
declare SQLCODE or SQLSTATE status variable required optional but Oracle ignores optional but Oracle ignores (2)
default external datatype of character host variables external datatype used for CHAR in TYPE and VAR statements CHARF VARCHAR2 VARCHAR2
default external datatype of string literals in SQL statements CHARF CHARF VARCHAR2
default internal datatype of CHAR variables in SQL statements CHAR CHAR VARCHAR2
default external datatype of CHAR variables in PL/SQL blocks CHARF CHARF VARCHAR2
default external datatype of value function USER returns CHARF CHARF VARCHAR2
external datatype code DESCRIBE returns (dynamic SQL Method 4) 96 96 1
integrity constraints enabled enabled disabled
PCTINCREASE for rollback segments not allowed not allowed allowed
MAXEXTENTS storage parameters not allowed not allowed allowed

6.7.7 DEFINE

Purpose

Specifies a user-defined symbol that is used to include or exclude portions of source code during a conditional precompilation. For more information, refer to "Conditional Precompilations".

Syntax

DEFINE=symbol

Default

None

Usage Notes

If you enter DEFINE inline, the EXEC ORACLE statement takes the following form:

EXEC ORACLE DEFINE <symbol>;

6.7.8 ERRORS

Purpose

Specifies whether precompiler error messages are sent to the terminal and listing file or only to the listing file.

Syntax

ERRORS={YES|NO}

Default

YES

Usage Notes

When ERRORS=YES, error messages are sent to the terminal and listing file.

When ERRORS=NO, error messages are sent only to the listing file.

6.7.9 FIPS

Purpose

Specifies whether extensions to ANSI/ISO SQL are flagged (by the FIPS Flagger). An extension is any SQL element that violates ANSI/ISO format or syntax rules, except privilege enforcement rules.

Syntax

FIPS={YES|NO}

Default

NO

Usage Notes

When FIPS=YES, the FIPS Flagger issues warning (not error) messages if you use an Oracle extension to the ANSI/ISO embedded SQL standard (SQL92) or use a SQL92 feature in a nonconforming manner.

The following extensions to ANSI/ISO SQL are flagged at precompile time:

  • Array interface including the FOR clause

  • SQLCA, ORACA, and SQLDA data structures

  • Dynamic SQL including the DESCRIBE statement

  • Embedded PL/SQL blocks

  • Automatic datatype conversion

  • DATE, COMP-3 (Pro*COBOL only), NUMBER, RAW, LONG RAW, VARRAW, ROWID, and VARCHAR datatypes

  • ORACLE OPTION statement for specifying runtime options

  • EXEC IAF and EXEC TOOLS statements in user exits

  • CONNECT statement

  • TYPE and VAR datatype equivalencing statements

  • AT db_name clause

  • DECLARE...DATABASE, ...STATEMENT, and ...TABLE statements

  • SQLWARNING condition in WHENEVER statement

  • DO and STOP actions in WHENEVER statement

  • COMMENT and FORCE TRANSACTION clauses in COMMIT statement

  • FORCE TRANSACTION and TO SAVEPOINT clauses in ROLLBACK statement

  • RELEASE parameter in COMMIT and ROLLBACK statements

  • Optional colon-prefixing of WHENEVER...DO labels and of host variables in the INTO clause

6.7.10 FORMAT

Purpose

Specifies the format of COBOL or FORTRAN input lines.

Syntax

FORMAT={ANSI|TERMINAL}

Default

ANSI

Usage Notes

Cannot be entered inline.

The format of input lines is system-dependent. Check your system-specific Oracle manuals.

When FORMAT=ANSI, the format of input lines conforms as much as possible to the current ANSI standard.

6.7.11 HOLD_CURSOR

Purpose

Specifies how the cursors for SQL statements and PL/SQL blocks are handled in the cursor cache.

Syntax

HOLD_CURSOR={YES|NO}

Default

NO

Usage Notes

You can use HOLD_CURSOR to improve the performance of your program. For more information, refer to Appendix C

When a SQL data manipulation statement is executed, its associated cursor is linked to an entry in the cursor cache. The cursor cache entry is in turn linked to an Oracle private SQL area, which stores information needed to process the statement. HOLD_CURSOR controls what happens to the link between the cursor and cursor cache.

When HOLD_CURSOR=NO, after Oracle executes the SQL statement and the cursor is closed, the precompiler marks the link as reusable. The link is reused as soon as the cursor cache entry to which it points is needed for another SQL statement. This frees memory allocated to the private SQL area and releases parse locks.

When HOLD_CURSOR=YES and RELEASE_CURSOR=NO, the link is maintained; the precompiler does not reuse it. This is useful for SQL statements that are executed often because it speeds up subsequent executions. There is no need to reparse the statement or allocate memory for an Oracle private SQL area.

For inline use with implicit cursors, set HOLD_CURSOR before executing the SQL statement. For inline use with explicit cursors, set HOLD_CURSOR before opening the cursor.

Note that RELEASE_CURSOR=YES overrides HOLD_CURSOR=YES and that HOLD_CURSOR=NO overrides RELEASE_CURSOR=NO. For information showing how these two options interact, refer to Table C-1.

6.7.12 HOST

Purpose

Specifies the host language to be used.

Syntax

HOST={COB74|COBOL}

Default

COBOL

Usage Notes

Cannot be entered inline.

COB74 refers to the 1974 version of ANSI-approved COBOL. COBOL refers to 1985 version. Other values might be available on your platform.

6.7.13 INAME

Purpose

Specifies the name of the input file.

Syntax

INAME=filename

Default

None

Usage Notes

Cannot be entered inline.

When specifying the name of your input file on the command line, the keyword INAME is optional. For example, in Pro*COBOL, you can specify myprog.pco instead of INAME=myprog.pco.

The precompiler assumes the standard input file extension (refer to Table 6-5). So, you need not use a file extension when specifying INAME unless the extension is nonstandard. For example, in Pro*FORTRAN, you can specify myprog instead of myprog.pfo.

Table 6-5 File Extensions

Host Language Standard File Extension
COBOL pco
FORTRAN pfo

For Pro*COBOL only, if you use a nonstandard input file extension when specifying INAME, you must also specify HOST.

6.7.14 INCLUDE

Purpose

Specifies a directory path for EXEC SQL INCLUDE files. It only applies to operating systems that use directories.

Syntax

INCLUDE=path

Default

Current directory

Usage Notes

Typically, you use INCLUDE to specify a directory path for the SQLCA and ORACA files. The precompiler searches first in the current directory, then in the directory specified by INCLUDE, and finally in a directory for standard INCLUDE files. Hence, you need not specify a directory path for standard files such as the SQLCA and ORACA.

You must still use INCLUDE to specify a directory path for nonstandard files unless they are stored in the current directory. You can specify more than one path on the command line, as follows:

... INCLUDE=<path1> INCLUDE=<path2> ...

The precompiler searches first in the current directory, then in the directory named by path1, then in the directory named by path2, and finally in the directory for standard INCLUDE files.

Remember, the precompiler looks for a file in the current directory first--even if you specify a directory path. So, if the file you want to INCLUDE resides in another directory, make sure no file with the same name resides in the current directory.

The syntax for specifying a directory path is system-specific. Follow the conventions of your operating system.

6.7.15 IRECLEN

Purpose

Specifies the record length of the input file.

Syntax

IRECLEN=integer

Default

80

Usage Notes

Cannot be entered inline.

The value you specify for IRECLEN should not exceed the value of ORECLEN. The maximum value allowed is system-dependent.

6.7.16 LITDELIM

Purpose

For Pro*COBOL only, the LITDELIM option specifies the delimiter for string constants and literals.

Syntax

LITDELIM={APOST|QUOTE}

Default

QUOTE

Usage Notes

When LITDELIM=APOST, the precompiler uses apostrophes when generating COBOL code. If you specify LITDELIM=QUOTE, quotation marks are used, as in

CALL "SQLROL" USING SQL-TMP0.

In SQL statements, you must use quotation marks to delimit identifiers containing special or lowercase characters, as in

EXEC SQL CREATE TABLE "Emp2" END-EXEC.

but you must use apostrophes to delimit string constants, as in

EXEC SQL SELECT ENAME FROM EMP WHERE JOB = 'CLERK' END-EXEC.

Regardless of which delimiter is used in the Pro*COBOL source file, the precompiler generates the delimiter specified by the LITDELIM value.

6.7.17 LNAME

Purpose

Specifies a nondefault name for the listing file.

Syntax

LNAME=filename

Default

input.LIS, where input is the base name of the input file.

Usage Notes

Cannot be entered inline.

By default, the listing file is written to the current directory.

6.7.18 LRECLEN

Purpose

Specifies the record length of the listing file.

Syntax

LRECLEN=integer

Default

132

Usage Notes

Cannot be entered inline.

The value of LRECLEN can range from 80 through 255. If you specify a value the range, 80 is used instead. If you specify a value earlier the range, 255 is used instead. LRECLEN should exceed IRECLEN by at least 8 to allow for the insertion of line numbers.

6.7.19 LTYPE

Purpose

Specifies the listing type.

Syntax

LTYPE={LONG|SHORT|NONE}

Default

LONG

Usage Notes

Cannot be entered inline.

When LTYPE=LONG, input lines appear in the listing file. When LTYPE=SHORT, input lines do not appear in the listing file. When LTYPE=NONE, no listing file is created.

6.7.20 MAXLITERAL

Purpose

Specifies the maximum length of string literals generated by the precompiler so that compiler limits are not exceeded. For example, if your compiler cannot handle string literals longer than 132 characters, you can specify MAXLITERAL=132 on the command line.

Syntax

MAXLITERAL=integer

Default

The default is precompiler-specific as shown here:

Precompiler Default
Pro*COBOL 256
Pro*FORTRAN 1000

Usage Notes

The maximum value of MAXLITERAL is compiler-dependent. The default value is language-dependent, but you might have to specify a lower value. For example, some COBOL compilers cannot handle string literals longer than 132 characters, so you would specify MAXLITERAL=132.

Strings that exceed the length specified by MAXLITERAL are divided during precompilation, then recombined (concatenated) at run time.

You can enter MAXLITERAL inline but your program can set its value just once, and the EXEC ORACLE statement must precede the first EXEC SQL statement. Otherwise, the precompiler issues a warning message, ignores the extra or misplaced EXEC ORACLE statement, and continues processing.

6.7.21 MAXOPENCURSORS

Purpose

Specifies the number of concurrently open cursors that the precompiler tries to keep cached.

Syntax

MAXOPENCURSORS=integer

Default

10

Usage Notes

You can use MAXOPENCURSORS to improve the performance of your program. For more information, refer to Appendix C

When precompiling separately, use MAXOPENCURSORS as described in "Separate Precompilations" .

MAXOPENCURSORS specifies the initial size of the SQLLIB cursor cache. If a new cursor is needed, and there are no free cache entries, Oracle tries to reuse an entry. Its success depends on the values of HOLD_CURSOR and RELEASE_CURSOR, and, for explicit cursors, on the status of the cursor itself. Oracle allocates an additional cache entry if it cannot find one to reuse. If necessary, Oracle keeps allocating additional cache entries until it runs out of memory or reaches the limit set by OPEN_CURSORS. To avoid a "maximum open cursors exceeded" Oracle error, MAXOPENCURSORS must be lower than OPEN_CURSORS by at least 6.

As your program's need for concurrently open cursors grows, you might want to respecify MAXOPENCURSORS to match the need. A value of 45 to 50 is not uncommon, but remember that each cursor requires another private SQL area in the user process memory space. The default value of 10 is adequate for most programs.

6.7.22 MODE

Purpose

Specifies whether your program observes Oracle practices or complies with the current ANSI SQL standard.

Syntax

MODE={ANSI|ISO|ANSI14|ISO14|ANSI13|ISO13|ORACLE}

Default

ORACLE

Usage Notes

Cannot be entered inline.

The following pairs of MODE values are equivalent: ANSI and ISO, ANSI14 and ISO14, ANSI13 and ISO13.

When MODE=ORACLE (the default), your embedded SQL program observes Oracle practices.

When MODE={ANSI14|ANSI13}, your program complies closely with the current ANSI SQL standard.

When MODE=ANSI, your program complies fully with the ANSI standard and the following changes go into effect:

  • CHAR column values, USER pseudocolumn values, character host values, and quoted literals are treated like ANSI fixed-length character strings. And, ANSI-compliant blank-padding semantics are used when you assign, compare, INSERT, UPDATE, SELECT, or FETCH such values.

  • Issuing a COMMIT or ROLLBACK closes all explicit cursors. (When MODE={ANSI13|ORACLE}, a commit or rollback closes only cursors referenced in a CURRENT OF clause.)

  • You cannot OPEN a cursor that is already open or CLOSE a cursor that is already closed. (When MODE=ORACLE, you can reOPEN an open cursor to avoid reparsing.)

  • The "no data found" Oracle warning code returned to SQLCODE becomes +100 instead of +1403. The error message text does not change.

  • No error message is issued if Oracle assigns a truncated column value to an output host variable.

When MODE={ANSI|ANSI14}, a 4-byte integer variable named SQLCODE (SQLCOD in FORTRAN) or a 5-byte character variable named SQLSTATE (SQLSTA in FORTRAN) must be declared. For more information, refer to "Error Handling Alternatives".

Table 6-4 shows how the MODE and DBMS settings interact. Other combinations are incompatible or are not recommended.

6.7.23 MULTISUBPROG

Purpose

For Pro*FORTRAN only, the MULTISUBPROG option specifies whether the Pro*FORTRAN precompiler generates COMMON statements and BLOCK DATA subprograms.

Note that this option allows Pro*FORTRAN release 1.3 applications to migrate to later releases. You can ignore the MUTISUBPROG option if you are not migrating Pro*FORTRAN release 1.3 source code.

Syntax

MULTISUBPROG={YES|NO}

Default

YES

Usage Notes

Cannot be entered inline.

When MULTISUBPROG=YES, the precompiler generates COMMON statements and BLOCK DATA subprograms. Your host program does not access the COMMON blocks directly, but it allows two or more program units in the same precompilation unit to contain SQL statements.

However, the precompiler can give COMMON blocks defined in different output files the same name. If you link the files into an executable program, you get a link-time or runtime error. To solve this problem, you can rename the input files or override the default COMMON block names by specifying the option COMMON_NAME. To avoid the problem, specify MULTISUBPROG=NO.

Specify MULTISUBPROG=NO if your Pro*FORTRAN source code has only a single subprogram in each source file (this was the restriction in release 1.3). When MULTISUBPROG=NO, the the COMMON_BLOCK option is ignored and the precompiler generates no COMMON statements or BLOCK DATA subprograms. Every program unit that contains executable SQL statements must have a Declare Section. Otherwise, you get a precompilation error. For input files that contain more than one embedded SQL program unit, the precompiler generates the same declarations in each unit.

6.7.24 Globalization Support_LOCAL

Purpose

For Pro*COBOL only, the Globalization Support_LOCAL option determines whether Globalization Support character conversions are performed by the precompiler runtime library or by the Oracle Server.

Syntax

Globalization Support_LOCAL={YES|NO}

Default

NO

Usage Notes

Cannot be entered inline.

When Globalization Support_LOCAL=YES, the runtime library (SQLLIB) locally performs blank-padding and blank-stripping for host variables that have multibyte Globalization Support datatypes.

When Globalization Support_LOCAL=NO, blank-padding and blank-stripping operations are not performed locally for host variables that have multibyte Globalization Support datatypes.

Release 7.2 of the Oracle database version 7 Server does not perform any blank-padding or blank-stripping of Globalization Support variables. When Globalization Support_LOCAL=NO, the Oracle Server returns an error upon executing a SQL statement that uses multibyte Globalization Support data.

6.7.25 ONAME

Purpose

Specifies the name of the output file.

Syntax

ONAME=filename

Default

System-dependent

Usage Notes

Cannot be entered inline.

Use this option to specify the name of the output file, where the name differs from that of the input file. For example, if you issue

procob INAME=my_test

the default output filename is my_test.cob. If you want the output filename to be my_test_1.cob, issue the command

procob INAME=my_test ONAME=my_test_1.cob

Note that you should add the .cob extension to files specified using ONAME. There is no default extension with the ONAME option.

Oracle recommends that you not let the output filename default, but rather name it explicitly using ONAME.

6.7.26 ORACA

Purpose

Specifies whether a program can use the Oracle Communications Area (ORACA).

Syntax

ORACA={YES|NO}

Default

NO

Usage Notes

When ORACA=YES, you must place the INCLUDE ORACA statement in your program.

6.7.27 ORECLEN

Purpose

Specifies the record length of the output file.

Syntax

ORECLEN=integer

Default

80

Usage Notes

Cannot be entered inline.

The value you specify for ORECLEN should equal or exceed the value of IRECLEN. The maximum value allowed is system-dependent.

6.7.28 PAGELEN

Purpose

Specifies the number of lines in each physical page of the listing file.

Syntax

PAGELEN=integer

Default

66

Usage Notes

Cannot be entered inline.

The maximum value allowed is system-dependent.

6.7.29 RELEASE_CURSOR

Purpose

Specifies how the cursors for SQL statements and PL/SQL blocks are handled in the cursor cache.

Syntax

RELEASE_CURSOR={YES|NO}

Default

NO

Usage Notes

You can use RELEASE_CURSOR to improve the performance of your program. For more information, refer toAppendix C.

When a SQL data manipulation statement is executed, its associated cursor is linked to an entry in the cursor cache. The cursor cache entry is in turn linked to an Oracle private SQL area, which stores information needed to process the statement. RELEASE_CURSOR controls what happens to the link between the cursor cache and private SQL area.

When RELEASE_CURSOR=YES, after Oracle executes the SQL statement and the cursor is closed, the precompiler immediately removes the link. This frees memory allocated to the private SQL area and releases parse locks. To make sure that associated resources are freed when you CLOSE a cursor, you must specify RELEASE_CURSOR=YES.

When RELEASE_CURSOR=NO and HOLD_CURSOR=YES, the link is maintained. The precompiler does not reuse the link unless the number of open cursors exceeds the value of MAXOPENCURSORS. This is useful for SQL statements that are executed often because it speeds up subsequent executions. There is no need to reparse the statement or allocate memory for an Oracle private SQL area.

For inline use with implicit cursors, set RELEASE_CURSOR before executing the SQL statement. For inline use with explicit cursors, set RELEASE_CURSOR before opening the cursor.

Note that RELEASE_CURSOR=YES overrides HOLD_CURSOR=YES and that HOLD_CURSOR=NO overrides RELEASE_CURSOR=NO. For information showing how these two options interact, refer to Appendix C

6.7.30 SELECT_ERROR

Purpose

Specifies whether your program generates an error when a single-row SELECT statement returns more than one row or more rows than a host array can accommodate.

Syntax

SELECT_ERROR={YES|NO}

Default

YES

Usage Notes

When SELECT_ERROR=YES, an error is generated if a single-row select returns too many rows or an array select returns more rows than the host array can accommodate.

When SELECT_ERROR=NO, no error is generated when a single-row select returns too many rows or when an array select returns more rows than the host array can accommodate.

Whether you specify YES or NO, a random row is selected from the table. To ensure a specific ordering of rows, use the ORDER BY clause in your SELECT statement. When SELECT_ERROR=NO and you use ORDER BY, Oracle returns the first row, or the first n rows if you are selecting into an array. When SELECT_ERROR=YES, whether or not you use ORDER BY, an error is generated if too many rows are returned.

6.7.31 SQLCHECK

Purpose

Specifies the type and extent of syntactic and semantic checking.

Syntax

SQLCHECK={SEMANTICS|FULL|SYNTAX|LIMITED|NONE}

Default

SYNTAX

Usage Notes

The values SEMANTICS and FULL are equivalent, as are the values SYNTAX and LIMITED.

The Oracle Precompilers can help you debug a program by checking the syntax and semantics of embedded SQL statements and PL/SQL blocks. Any errors found are reported at precompile time.

You control the level of checking by entering the SQLCHECK option inline and on the command line, inline and on the command line. However, the level of checking you specify inline cannot be higher than the level you specify (or accept by default) on the command line. For example, if you specify SQLCHECK=NONE on the command line, you cannot specify SQLCHECK=SYNTAX inline.

If SQLCHECK=SYNTAX|SEMANTICS, the precompiler generates an error when PL/SQL reserved words are used in SQL statements, even though the SQL statements are not themselves PL/SQL. If a PL/SQL reserved word must be used as an identifier, you can enclose it in double-quotes.

When SQLCHECK=SEMANTICS, the precompiler checks the syntax and semantics of

  • Data manipulation statements such as INSERT and UPDATE

  • PL/SQL blocks

However, the precompiler checks only the syntax of remote data manipulation statements (those using the AT db_name clause).

The precompiler gets the information for a semantic check from embedded DECLARE TABLE statements or, if you specify the option USERID, by connecting to Oracle and accessing the data dictionary. You need not connect to Oracle if every table referenced in a data manipulation statement or PL/SQL block is defined in a DECLARE TABLE statement.

If you connect to Oracle but some information cannot be found in the data dictionary, you must use DECLARE TABLE statements to supply the missing information. During precompilation, a DECLARE TABLE definition overrides a data dictionary definition if they conflict.

Specify SQLCHECK=SEMANTICS when precompiling new programs. If you embed PL/SQL blocks in a host program, you must specify SQLCHECK=SEMANTICS and the option USERID.

When SQLCHECK=SYNTAX, the precompiler checks the syntax of

  • Data manipulation statements

  • PL/SQL blocks

No semantic checking is done. DECLARE TABLE statements are ignored and PL/SQL blocks are not allowed. When checking data manipulation statements, the precompiler uses Oracle database version 7 syntax rules, which are are downwardly compatible. Specify SQLCHECK=SYNTAX when migrating your precompiled programs.

When SQLCHECK=NONE, no syntactic or semantic checking is done. DECLARE TABLE statements are ignored and PL/SQL blocks are not allowed. Specify SQLCHECK=NONE if your program

  • Contains non-Oracle SQL (for example, because it will connect to a non-Oracle server through Open Gateway)

  • References tables not yet created and lacks DECLARE TABLE statements for them

Table 6-6 summarizes the checking done by SQLCHECK. For more information about syntactic and semantic checking, refer to Appendix D.

Table 6-6 SQLCHECK Checking


SQLCHECK=SEMANTIC SQLCHECK=SYNTAX SQLCHECK=NONE

Syntax Semantic Syntax Semantic Syntax Semantic
DML Y Y Y


Remote DML Y
Y


PL/SQL Y Y




6.7.32 UNSAFE_NULL

Purpose

Specifying UNSAFE_NULL=YES prevents generation of ORA-01405 messages when fetching NULLs without using indicator variables.

Syntax

UNSAFE_NULL={YES|NO}

Default

NO

Usage Notes

Cannot be entered inline.

The UNSAFE_NULL=YES is allowed only when MODE=ORACLE and DBMS=V7.

The UNSAFE_NULL option has no effect on host variables in an embedded PL/SQL block. You must use indicator variables to avoid ORA-01405 errors.

6.7.33 USERID

Purpose

Specifies an Oracle username and password.

Syntax

USERID=username/password

Default

None

Usage Notes

Cannot be entered inline.

Do not specify this option when using the automatic logon feature, which accepts your Oracle username prefixed with the value of the Oracle initialization parameter OS_AUTHENT_PREFIX.

When SQLCHECK=SEMANTICS, if you want the precompiler to get needed information by connecting to Oracle and accessing the data dictionary, you must also specify USERID.

6.7.34 VARCHAR

Purpose

For Pro*COBOL only, the VARCHAR option instructs the precompiler to treat the COBOL group item described in Chapter 1 of the Pro*COBOL Supplement to the Oracle Precompilers Guide as a VARCHAR datatype.

Syntax

VARCHAR={YES|NO}

Default

NO

Usage Notes

Cannot be entered inline.

When VARCHAR=YES, the implicit group item described in Chapter 1 of the Pro*COBOL Supplement to the Oracle Precompilers Guide is accepted as an Oracle database version 7 VARCHAR external datatype with a length field and a string field.

When VARCHAR=NO, the Pro*COBOL Precompiler does not accept the implicit group items as VARCHAR external datatypes.

6.7.35 XREF

Purpose

Specifies whether a cross-reference section is included in the listing file.

Syntax

XREF={YES|NO}

Default

YES

Usage Notes

When XREF=YES, cross references are included for host variables, cursor names, and statement names. The cross references show where each object is defined and referenced in your program.

When XREF=NO, the cross-reference section is not included.

6.8 Conditional Precompilations

Conditional precompilation includes (or excludes) sections of code in your host program based on certain conditions. For example, you might want to include one section of code when precompiling under UNIX and another section when precompiling under VMS. Conditional precompilation lets you write programs that can run in different environments.

Conditional sections of code are marked by statements that define the environment and actions to take. You can code host-language statements as well as EXEC SQL statements in these sections. The following statements let you exercise conditional control over precompilation:

EXEC ORACLE DEFINE symbol; -- define a symbol
EXEC ORACLE IFDEF symbol; -- if symbol is defined
EXEC ORACLE IFNDEF symbol; -- if symbol is not defined
EXEC ORACLE ELSE; -- otherwise
EXEC ORACLE ENDIF; -- end this control block

All EXEC ORACLE statements must be terminated with the statement terminator for your host language. For example, in Pro*COBOL, a conditional statement must be terminated with "END-EXEC." and in Pro*FORTRAN it must be terminated by a return character.

6.8.1 An Example

In the following example, the SELECT statement is precompiled only when the symbol site2 is defined:

EXEC ORACLE IFDEF site2;
 EXEC SQL SELECT DNAME
 INTO :dept_name
 FROM DEPT
 WHERE DEPTNO = :dept_number;
EXEC ORACLE ENDIF;

Blocks of conditions can be nested as shown in the following example:

EXEC ORACLE IFDEF outer;
 EXEC ORACLE IFDEF inner;
 ...
 EXEC ORACLE ENDIF;
EXEC ORACLE ENDIF;

You can "comment out" host-language or embedded SQL code by placing it between IFDEF and ENDIF and not defining the symbol.

6.8.2 Defining Symbols

You can define a symbol in two ways. Either include the statement

EXEC ORACLE DEFINE symbol;

in your host program or define the symbol on the command line using the syntax

... INAME=filename ... DEFINE=symbol

where symbol is not case-sensitive.

Some port-specific symbols are predefined for you when the Oracle Precompilers are installed on your system. For example, predefined operating system symbols include CMS, MVS, MS-DOS, UNIX, and VMS.

6.9 Separate Precompilations

With the Oracle Precompilers, you can precompile several host program modules separately, then link them into one executable program. This supports modular programming, which is required when the functional components of a program are written and debugged by different programmers. The individual program modules need not be written in the same language.

6.9.1 Guidelines

The following guidelines will help you avoid some common problems.

Referencing Cursors

Cursor names are SQL identifiers, whose scope is the precompilation unit. Hence, cursor operations cannot span precompilation units (files). That is, you cannot declare a cursor in one file and open or fetch from it in another file. So, when doing a separate precompilation, make sure all definitions and references to a given cursor are in one file.

Specifying MAXOPENCURSORS

When you precompile the program module that connects to Oracle, specify a value for MAXOPENCURSORS that is high enough for any of the program modules. If you use it for another program module, MAXOPENCURSORS is ignored. Only the value in effect for the connect is used at run time.

Using a Single SQLCA

If you want to use just one SQLCA, you must declare it globally in one of the program modules.

6.9.2 Restrictions

All references to an explicit cursor must be in the same program file. You cannot perform operations on a cursor that was DECLAREd in a different module. refer to   Using Embedded SQL for more information about cursors.

Also, any program file that contains SQL statements must have a SQLCA that is in the scope of the local SQL statements.

6.10 Compiling and Linking

To get an executable program, you must compile the source file(s) produced by the precompiler, then link the resulting object module with any modules needed from SQLLIB and system-specific Oracle libraries. Also, if you are embedding OCI calls, make sure to link in the OCI runtime library (OCILIB).

The linker resolves symbolic references in the object modules. If these references conflict, the link fails. This can happen when you try to link third party software into a precompiled program. Not all third-party software is compatible with Oracle, so you might have problems. Check with Oracle Customer Services to see if the software is supported.

Compiling and linking are system-dependent. For instructions, see your system-specific Oracle manuals.

6.10.1 System-Dependent

Compiling and linking are system-dependent. For example, on some systems, you must turn off compiler optimization when compiling a host language program. For instructions, refer to your system-specific Oracle documentation.

6.10.2 Multibyte Globalization Support Compatibility

When using multibyte Globalization Support features, you must link your object files to the current version of the SQLLIB runtime library. The multibyte Globalization Support features in this release are supported by the SQLLIB runtime library and not by the Oracle Server. The resulting application can then be executed with any release of the Oracle database version 7 Server.