Help using Base SAS procedures

CONNECT to oracle vs Libname SQL Joins (+)

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

CONNECT to oracle vs Libname SQL Joins (+)

Hi! I have a question about SQL joins using (+)

 

If I run a query using a connection to Oracle...

 

PROC SQL;

   CONNECT TO ORACLE (USER='xxxxx' PASSWORD=xxxx PATH etc);

   CREATE TABLE QUERY2 AS

   SELECT * FROM CONNECTION TO ORACLE

   (SELECT F1,F2,F3 FROM XXX WHERE A=B  AND C=D(+))

 

it works fine

but when I use a LIBNAME to set up the connection and just use a PROC SQL;

it errors on the (+)

 

DO I have to do the LEFT OUTER JOIN? (Hope not.. the actual query is enormous lol)

 

Thanks!!

 


Accepted Solutions
Solution
‎10-26-2017 01:13 PM
Super User
Posts: 23,776

Re: CONNECT to oracle vs Libname SQL Joins (+)

(+) is not valid SAS syntax, so yes, you need to rewrite the query in SAS SQL not Oracle SQL.

View solution in original post


All Replies
Solution
‎10-26-2017 01:13 PM
Super User
Posts: 23,776

Re: CONNECT to oracle vs Libname SQL Joins (+)

(+) is not valid SAS syntax, so yes, you need to rewrite the query in SAS SQL not Oracle SQL.

Contributor
Posts: 27

Re: CONNECT to oracle vs Libname SQL Joins (+)

well **bleep** lol. Not sure I can convert this query to left joins easily Smiley Happy Thanks!!!

Super User
Super User
Posts: 8,127

Re: CONNECT to oracle vs Libname SQL Joins (+)

I am not sure I understand the question.  Are you asking if you can ORACLE specific SQL enhancements in SAS PROC SQL code?

If so then the answer is no.

PROC SQL uses ANSI SQL 92 standard syntax, plus some SAS specific enhancements.

PROC Star
Posts: 514

Re: CONNECT to oracle vs Libname SQL Joins (+)

yes it changes to left join

Super User
Super User
Posts: 8,127

Re: CONNECT to oracle vs Libname SQL Joins (+)

Why not just leave the query in ORACLE code?

libname mydata oracle ..... ;
proc sql ;
connect using mydata;
create table want as select * from connection to mydata
( ... oracle query ...)
;
quit;
Contributor
Posts: 27

Re: CONNECT to oracle vs Libname SQL Joins (+)

Hi Tom i cant get this to work?

 

LIBNAME CAT ORACLE SCHEMA=CAT USER='xxxxxxx' PASSWORD='xxxxxx' PATH='@xxxx';

 

PROC SQL;

CONNECT USING CAT;  <<< Error  (connect in red)

 

wait... SAS EG flags that as RED/error but it works... cool Smiley Happy

Super User
Super User
Posts: 8,127

Re: CONNECT to oracle vs Libname SQL Joins (+)

The EDITOR is not SAS.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 357 views
  • 3 likes
  • 4 in conversation