LIBNAME Statement Specifics for Oracle

Overview

This section describes the LIBNAME statement that SAS/ACCESS Interface to Oracle supports and includes examples. For details about this feature, see the LIBNAME statement.
Here is the LIBNAME statement syntax for accessing Oracle.
LIBNAME libref oracle <connection-options> <LIBNAME-options>;

Arguments

libref
specifies any SAS name that serves as an alias to associate SAS with a database, schema, server, or group of tables and views.
oracle
specifies the SAS/ACCESS engine name for the Oracle interface.
connection-options
provide connection information and control how SAS manages the timing and concurrence of the connection to the DBMS. Here is how these options are defined.
USER=<'>Oracle-user-name<'>
specifies an optional Oracle user name. If the user name contains blanks or national characters, enclose it in quotation marks. If you omit an Oracle user name and password, the default Oracle user ID OPS$sysid is used, if it is enabled. USER= must be used with PASSWORD=.
PASSWORD=<'>Oracle-password<'>
specifies an optional Oracle password that is associated with the Oracle user name. If you omit it, the password for the default Oracle user ID OPS$sysid is used, if it is enabled. If the password contains spaces or nonalphanumeric characters, you must enclose it in quotation marks. If you specify USER=, you must specify PASSWORD=.
PATH=<'>Oracle-database-specification<'>
specifies the Oracle driver, node, and database. Aliases are required if you are using SQL*Net Version 2.0 or later. In some operating environments, you can enter the information that is required by the PATH= statement before invoking SAS.
SAS/ACCESS uses the same Oracle path designation that you use to connect to Oracle directly. See your database administrator to determine the databases that have been set up in your operating environment, and to determine the default values if you do not specify a database. On UNIX systems, the TWO_TASK environment variable is used, if set. If neither the PATH= nor the TWO_TASK values have been set, the default value is the local driver.
If you specify the appropriate system options or environment variables for Oracle, you can often omit the connection options from your LIBNAME statements. See your Oracle documentation for details.
LIBNAME-options
define how SAS processes DBMS objects. Some LIBNAME options can enhance performance, and others determine locking or naming behavior. The following table describes the LIBNAME options for SAS/ACCESS Interface to Oracle, with the applicable default values. For more detail about these options, see LIBNAME Options for Relational Databases.
SAS/ACCESS LIBNAME Options for Oracle
Option
Default Value
none
conditional
YES
none
SHAREDREAD
none
YES
(TABLES VIEWS)
matches the maximum number of bytes per single character of the SAS session encoding
1000 when inserting rows; 0 when updating, deleting, or appending to an existing table
none
none
none
DBMS
NO
none
none
the local database
1024
NO
YES
NO
usually 1
THREADED_APPS,2
NO
none
YES
1 is the forced default when REREAD_EXPOSURE=YES; otherwise, 10
YES
NONE
NO
YES
NO
NO
250
NOLOCK
NO
SAS accesses objects in the default and public schemas
YES
YES
none
none
DBMS
NOLOCK
1
NO

Oracle LIBNAME Statement Examples

In this first example, default settings are used for the connection options to make the connection. If you specify the appropriate system options or environment variables for Oracle, you can often omit the connection options from your LIBNAME statements. See your Oracle documentation for details.
libname myoralib oracle;
In the next example, the libref MYDBLIB uses SAS/ACCESS Interface to Oracle to connect to an Oracle database. The SAS/ACCESS connection options are USER=, PASSWORD=, and PATH=. PATH= specifies an alias for the database specification, which SQL*Net requires.
libname mydblib oracle user=testuser password=testpass path=hrdept_002;

proc print data=mydblib.employees;
   where dept='CSR010';
run;