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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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