BookmarkSubscribeRSS Feed
jhh197
Pyrite | Level 9

PROC SQL;

CONNECT to ORACLE as EX(authdomain=yyyy path=xxx connection=global);

 

 

CREATE TABLE TEST20

AS

SELECT * FROM CONNECTION TO EX (

WITH TMP_HD AS

 

(

SELECT

CDR.* ,

 

MF.DATE,

MF.CD

 

 

FROM

 

SP_V.TEST1 CDR

 

LEFT JOIN SP_V.TEST2 MF

ON MF.ID=CDR.ID

 

 

WHERE

CDR.ID =100

 

 

),

TMP_SPL AS

 

(

SELECT

 

SPL.REGION,

PCS.TYPE

 

FROM SP_V.TEST3 SPL

 

JOIN TMP_HD S

ON SPL.REGION = S.REGION

 

JOIN SP_V.TEST4 PCS

ON SPL.REGION = PCS.REGION

 

)

 

 

SELECT H.*, F.*

FROM TMP_HD H

LEFT JOIN TMP_SPL F

ON H.REGION = F.REGION

 

 

);

DISCONNECT FROM EX ;

QUIT;

 

When I run above code it gives below error

ERROR: ORACLE prepare error: ORA-00907: missing right parenthesis.

 

Can anyone please help .

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

Please reformat your code.

As it is, maybe a rogue character has entered it, probably in one of the WITH clauses, and maybe near the end. Remove all spaces and retype them.

A proper editor such as Notepad++ can display all the characters.

SASKiwi
PROC Star

The error is perfectly obvious. Count the number of left parentheses (4) and the number of right parentheses (3) in the posted code. You are missing one right parentheses to balance your syntax. As to where it should go I'll leave that up to you as you are using Oracle-specific syntax and type of joining you are doing is not clear to me.

ChrisNZ
Tourmaline | Level 20

I must be blind, I see balanced parentheses.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 614 views
  • 0 likes
  • 3 in conversation