BookmarkSubscribeRSS Feed
cmcquain
Fluorite | Level 6

I am trying to use a subquery within a left join and I am getting this error.

 

ERROR: ORACLE prepare error: ORA-00905: missing keyword. SQL statement: select WDM_HSBSB_SUBSC.SBSB_ID as CARD_HLDR_ID_NUM,

WDM_HMEME_MEMBER.MEME_FIRST_NAME || ' ' || WDM_HMEME_MEMBER.MEME_LAST_NAME as PATIENT_NAME, WDM_HMEME_MEMBER.MEME_BIRTH_DT

 

Here is a sample of my code

 

left join

select

   max (HIDCD_SK) as max_HIDCD_SK,

       IDCD_DESC

from WDM_HIDCD_DIAG_CD

where max_HIDCD_SK = HIDCD_SK) as DIAG_DESC

on (WDM_DDIST_DIAG_SET.DDIST_IDCD_AD = DIAG_DESC.max_HIDCD_SK)

 

where

WDM_HSBSB_SUBSC.SBSB_ID in

('XXXXX') 

and WDM_DFNIN_FUNDING_INFO.DFNIN_CLAIM_TYPE <> 'R' /* R = pharmacy */

and WFT_FCDML_CL_LINE.FCDML_RPT_PAID_DT <> WFT_FCDML_CL_LINE.FCDML_PROCESS_DT

and WDM_HCLCL_CLAIM.HCLCL_AS_OF_TO_DT = '31-Dec-9999'

and WDM_DCDBC_CL_LINE_BCN_CODES.DCDCD_DENIAL_IND = 'N'

 

What am I doing wrong?

 

5 REPLIES 5
LinusH
Tourmaline | Level 20

Since you are not sharing the full code, I'm assuming your submitting this in a pass through block (...FROM CONNECTION TO...).

Everything within this block is totally agnostic for SAS, it's the responsibility for the target DBMS (Oracle). So reach out to your fellow Oracle users instead.

Data never sleeps
cmcquain
Fluorite | Level 6

You are correct I am using a pass through.  I will start searching oracle joins then.

 

Thank you

Reeza
Super User

where max_HIDCD_SK = HIDCD_SK) as DIAG_DESC

on (WDM_DDIST_DIAG_SET.DDIST_IDCD_AD = DIAG_DESC.max_HIDCD_SK)


That first line doesn't look correct, you usually don't alias on WHERE conditions?

SASKiwi
PROC Star

Where does your subquery end? I don't see any closing bracket.

cmcquain
Fluorite | Level 6

It's there.  I just didn't copy and paste it.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 2829 views
  • 0 likes
  • 4 in conversation