13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>SAS</strong>/<strong>ACCESS</strong> Interface to Oracle 4 Nonpartitioned Oracle Tables 717partition (SALES1) UNION ALL SELECT "ACCT_NO","ACCT_NAME", "AMOUNT_OF_SALE","QTR_NO" FROM SALES partition (SALES4)Using DB_ONE_CONNECT_PER_THREAD=NO, however, you can override thedefault behavior of limiting the number of connections to the number of threads. Asshown below, <strong>SAS</strong> makes four separate connections to the Oracle server and eachconnection reads from each of the partition.libname x oracle user=testuser path=oraserver;data new;set x.SALES (DBSLICEPARM=(ALL,2) DB_ONE_CONNECT_PER_THREAD=NO );run;ORACLE: SELECT "ACCT_NO","ACCT_NAME", "AMOUNT_OF_SALE", "QTR_NO" FROM SALESpartition (SALES2)ORACLE: SELECT "ACCT_NO","ACCT_NAME", "AMOUNT_OF_SALE", "QTR_NO" FROM SALESpartition (SALES3)ORACLE: SELECT "ACCT_NO","ACCT_NAME", "AMOUNT_OF_SALE", "QTR_NO" FROM SALESpartition (SALES1)ORACLE: SELECT "ACCT_NO","ACCT_NAME", "AMOUNT_OF_SALE", "QTR_NO" FROM SALESpartition (SALES4)The second parameter of the DBSLICEPARM= LIBNAME option determines thenumber of threads to read the table in parallel. The number of partitions on the table,the maximum number of allowed threads, and the value ofDB_ONE_CONNECT_PER_THREAD= determine the number of connections to theOracle server <strong>for</strong> retrieving rows from the table.Nonpartitioned Oracle TablesIf the table is not partitioned, and the DBSLICE= option is not specified, Oracleresorts to the MOD function (see “Autopartitioning Techniques in <strong>SAS</strong>/<strong>ACCESS</strong>” onpage 57 With this technique, the engine makes N connections, and each connectionretrieves rows based on a WHERE clause as follows:WHERE ABS(MOD(ModColumn,N))=R3 ModColumn is a column in the table of type integer and is not used in any userspecified WHERE clauses. (The engine selects this column. If you do not thinkthis is the ideal partitioning column, you can use the DBSLICE= data set option tooverride this default behavior.)3 R varies from 0 to (N-1) <strong>for</strong> each of the N WHERE clauses.3 N defaults to 2, and N can be overridden with the second parameter in theDBSLICEPARM= data set option.The Oracle engine selects the ModColumn to use in this technique. Any numericcolumn with zero scale value can qualify as the ModColumn. However, if a primary keycolumn is present, it is preferred over all others. Generally, values in the primary keycolumn are in a serial order and yield an equal number of rows <strong>for</strong> each connection.This example illustrates the point:create table employee (empno number(10) primary key,empname varchar2(20), hiredate date,salary number(8,2), gender char(1));

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!