Usage Note 37888: Defining a schema in SAS/ACCESS® Interface to Oracle
When you use SAS/ACCESS Interface to Oracle to connect to the Oracle database, the SAS® System looks for tables that are owned or created by the user ID that is listed in the LIBNAME statement. If the software does not find any tables associated with that user ID, the SAS log still shows that the library was assigned successfully, as shown in the following example output:
libname mylib oracle user=user-id password=password path=path;
NOTE: Libref MYLIB was successfully assigned as follows:
Engine: ORACLE
However, no tables appear in the library in the SAS Explorer window, as shown here:
The library does not show any tables because there are no tables owned or created by the user ID from the LIBNAME statement. Therefore, you need to define a schema in the LIBNAME statement. A schema is the owner or creator of tables. To see tables that are owned or created by a different user, you must use the SCHEMA=schema-name option in the LIBNAME statement.
To determine the schema for your tables, follow these steps:
- Submit the following code using your Oracle user ID, password, and database path:
proc sql;
connect to oracle(user=user-id password=password
path=database-path);
create table work.oraSchema as
select * from connection to oracle
(select owner, table_name from all_tables
order by owner);
quit;
After you run the code, open the created table to see the schema and table names:
- Scroll through the Work.Oraschema table to find the owner name for the table that you want to see.
- Use the owner name for that table as the value in the SCHEMA= option in your LIBNAME statement. For example, if you want to see the CLASS table, you must use SCHEMA=SCOTT in the LIBNAME statement, as shown here:
libname mylib oracle user=user-id password=password
path=path schema=scott;
When you submit the LIBNAME statement in this example, the tables with a schema value of SCOTT appear in the Explorer window.
Operating System and Release Information
SAS System | SAS/ACCESS Interface to Oracle | z/OS | 9.1 TS1M3 SP4 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |
Windows Vista | 9.1 TS1M3 SP4 | |
64-bit Enabled AIX | 9.1 TS1M3 SP4 | |
64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | |
64-bit Enabled Solaris | 9.1 TS1M3 SP4 | |
HP-UX IPF | 9.1 TS1M3 SP4 | |
Linux | 9.1 TS1M3 SP4 | |
Linux on Itanium | 9.1 TS1M3 SP4 | |
OpenVMS Alpha | 9.1 TS1M3 SP4 | |
Solaris for x64 | 9.1 TS1M3 SP4 | |
Tru64 UNIX | 9.1 TS1M3 SP4 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Usage Note |
Priority: | |
Topic: | Data Management ==> Data Sources ==> External Databases ==> Oracle
|
Date Modified: | 2009-12-22 10:43:53 |
Date Created: | 2009-11-18 14:26:59 |