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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 3403 views
  • 0 likes
  • 4 in conversation