Wednesday, June 03, 2015

Oracle Hints SAS



If any of you are using SAS and query data from Oracle database with HINTS, you might want to take note that Oracle Hints will be considered as comments in SAS and will be ignored and will not be passed to the Oracle database.  You won't even be able to see them on the DB side in your SQL, unless (what an interesting word) you have the "PRESERVE_COMMENTS" keyword set in your SAS connect.

EXAMPLE:



proc sql;   
connect to oracle as mycon(user=testuser
        password=testpass preserve_comments);   
select *      
   from connection to mycon
     (select /* +indx(empid) all_rows */
          count(*) from employees);
quit;

Your can refer to the following note for more detail:

Usage Note 7290: Oracle hints are not passed when coded in a SAS macro :    http://support.sas.com/kb/7/290.html