The query runs fine in SQL Developer and Toad. Also when I remove the hint the query runs fine in pass thru.
Following is the query
SELECT SFRSTCR_PIDM,
SSBSECT_SUBJ_CODE,
SSBSECT_CRSE_NUMB,
SSBSECT_SEQ_NUMB,
SSBSECT_SUBJ_CODE || ' ' || SSBSECT_CRSE_NUMB || SSBSECT_SEQ_NUMB AS COURSE,
MIN(SFRSTCR_TERM_CODE),
SHRTCKG_GRDE_CODE_FINAL
FROM (SELECT /*+ USE_HASH(Q1,SHRTCKN) ORDERED */ DISTINCT SFRSTCR_PIDM,
SFRSTCR_TERM_CODE,
SSBSECT_SUBJ_CODE,
SSBSECT_CRSE_NUMB,
CASE WHEN SSBSECT_SEQ_NUMB LIKE '%CC' THEN ' CC'
WHEN SSBSECT_SEQ_NUMB LIKE '%E' THEN ' E'
WHEN SSBSECT_SEQ_NUMB LIKE '%I' THEN ' I'
WHEN SSBSECT_SEQ_NUMB LIKE '%S' THEN ' S'
ELSE '' END AS SSBSECT_SEQ_NUMB,
SHRTCKG_GRDE_CODE_FINAL
FROM SFRSTCR
JOIN SSBSECT
ON SFRSTCR_CRN = SSBSECT_CRN
AND SFRSTCR_TERM_CODE = SSBSECT_TERM_CODE
LEFT OUTER JOIN SHRTCKN
ON SSBSECT_CRN = SHRTCKN_CRN
AND SSBSECT_TERM_CODE = SHRTCKN_TERM_CODE
AND SSBSECT_SUBJ_CODE IN ('ENG', 'MAT', 'INT', 'CAR', 'REA')
AND SHRTCKN_PIDM = SFRSTCR_PIDM
LEFT OUTER JOIN (SELECT SHRTCKG_PIDM,
SHRTCKG_TCKN_SEQ_NO,
SHRTCKG_TERM_CODE,
SHRTCKG_GRDE_CODE_FINAL
FROM SHRTCKG M
WHERE SHRTCKG_SEQ_NO IN (SELECT MAX(SHRTCKG_SEQ_NO)
FROM SHRTCKG N
WHERE M.SHRTCKG_PIDM = N.SHRTCKG_PIDM
AND M.SHRTCKG_TCKN_SEQ_NO = N.SHRTCKG_TCKN_SEQ_NO
AND M.SHRTCKG_TERM_CODE = N.SHRTCKG_TERM_CODE
AND SHRTCKG_TERM_CODE >= 200909)) Q1
ON Q1.SHRTCKG_TCKN_SEQ_NO = SHRTCKN.SHRTCKN_SEQ_NO
AND Q1.SHRTCKG_PIDM = SHRTCKN.SHRTCKN_PIDM
AND Q1.SHRTCKG_TERM_CODE = SHRTCKN.SHRTCKN_TERM_CODE
AND NVL (SHRTCKN.SHRTCKN_REPEAT_COURSE_IND, '!') <> 'E'
WHERE SFRSTCR_RSTS_CODE IN (SELECT STVRSTS_CODE
FROM STVRSTS
WHERE STVRSTS_INCL_SECT_ENRL = 'Y')
AND SFRSTCR_TERM_CODE >= '200909')
WHERE SSBSECT_SUBJ_CODE || ' ' || SSBSECT_CRSE_NUMB || SSBSECT_SEQ_NUMB = '&S_COURSE'
GROUP BY SFRSTCR_PIDM, SSBSECT_SUBJ_CODE, SSBSECT_CRSE_NUMB, SSBSECT_SEQ_NUMB, SHRTCKG_GRDE_CODE_FINAL
8004, Windows 7 64 Bit