不确定我是否在正确的位置,但下面是我正在处理的代码,我收到错误消息:
OraOLEDB:ORA-00923:找不到FROM关键字 OraOLEDB:ORA-00923:未找到FROM关键字“
我已经尝试了所有我能想到的东西来修复它而无法理解它。任何帮助将不胜感激。
select xx.*,
XX.TermCode
FROM(
Select *,
CASE WHEN ZZ.ACTC IS NULL AND ZZ.SATC IS NULL THEN NULL
WHEN ZZ.ACTC IS NULL THEN ZZ.SATC
WHEN ZZ.SATC IS NULL THEN ZZ.ACTC
WHEN ZZ.SATC>=ZZ.ACTC THEN ZZ.SATC
WHEN ZZ.ACTC>=ZZ.SATC THEN ZZ.ACTC
ELSE NULL END "BEST"
FROM (
Select
AA.SARADAP_TERM_CODE_ENTRY as "TermCode",
BB.SPRIDEN_ID as "RNumber",
BB.SPRIDEN_FIRST_NAME as "FirstName",
BB.SPRIDEN_LAST_NAME as "LastName",
CC.SPBPERS_SEX as "Gender",
CC.SPBPERS_ETHN_CDE as "Ethnicity",
(Select GG.GORRACE_DESC from GENERAL.GORRACE GG, GENERAL.GORPRAC GE
where GE.GORPRAC_RACE_CDE = '1'
and GE.GORPRAC_RACE_CDE = GG.GORRACE_RACE_CDE
AND AA.SARADAP_PIDM = GE.GORPRAC_PIDM) "Race1",
(Select GG.GORRACE_DESC from GENERAL.GORRACE GG, GENERAL.GORPRAC GE
where GE.GORPRAC_RACE_CDE = '2'
and GE.GORPRAC_RACE_CDE = GG.GORRACE_RACE_CDE
AND AA.SARADAP_PIDM = GE.GORPRAC_PIDM) "Race2",
(Select GG.GORRACE_DESC from GENERAL.GORRACE GG, GENERAL.GORPRAC GE
where GE.GORPRAC_RACE_CDE = '3'
and GE.GORPRAC_RACE_CDE = GG.GORRACE_RACE_CDE
AND AA.SARADAP_PIDM = GE.GORPRAC_PIDM) "Race3",
(Select GG.GORRACE_DESC from GENERAL.GORRACE GG, GENERAL.GORPRAC GE
where GE.GORPRAC_RACE_CDE = '4'
and GE.GORPRAC_RACE_CDE = GG.GORRACE_RACE_CDE
AND AA.SARADAP_PIDM = GE.GORPRAC_PIDM) "Race4",
(Select GG.GORRACE_DESC from GENERAL.GORRACE GG, GENERAL.GORPRAC GE
where GE.GORPRAC_RACE_CDE = '5'
and GE.GORPRAC_RACE_CDE = GG.GORRACE_RACE_CDE
AND AA.SARADAP_PIDM = GE.GORPRAC_PIDM) "Race5",
DD.STVLGCY_DESC as "Legacy",
CC.SPBPERS_CITZ_CODE as "Citizenship",
AA.SARADAP_ADMT_CODE as "AdmitType",
AA.SARADAP_STYP_CODE as "SType",
AA.SARADAP_APST_CODE as "AppStatus",
AA.SARADAP_APST_DATE as "AppDate",
EE.SARAPPD_APDC_CODE as "Decision",
EE.SARAPPD_APDC_DATE as "Date",
AA.SARADAP_RECR_CODE as "Recruiter",
FF.STVSBGI_DESC as "HighSchool",
LL.SOBSBGI_CITY as "City",
LL.SOBSBGI_STAT_CODE as "State",
MM.SORHSCH_CLASS_RANK as "Rank",
MM.SORHSCH_CLASS_SIZE as "Size",
(select PA.SPRTELE_PHONE_AREA
from SATURN.SPRTELE PA
where PA.SPRTELE_TELE_CODE ='PR'
and AA.SARADAP_PIDM = PA.SPRTELE_PIDM
and PA.SPRTELE_STATUS_IND IS NULL
and PA.SPRTELE_PRIMARY_IND ='Y') "PR_AreaCode",
(select PN.SPRTELE_PHONE_NUMBER
from SATURN.SPRTELE PN
where PN.SPRTELE_TELE_CODE ='PR'
and AA.SARADAP_PIDM = PN.SPRTELE_PIDM
and PN.SPRTELE_STATUS_IND IS NULL
and PN.SPRTELE_PRIMARY_IND ='Y') "PR_Phone",
(select SA.SPRTELE_PHONE_AREA
from SATURN.SPRTELE SA
where SA.SPRTELE_TELE_CODE ='SC'
and AA.SARADAP_PIDM = SA.SPRTELE_PIDM
and SA.SPRTELE_STATUS_IND IS NULL) "SC_AreaCode",
(select SP.SPRTELE_PHONE_NUMBER
from SATURN.SPRTELE SP
where SP.SPRTELE_TELE_CODE ='SC'
and AA.SARADAP_PIDM = SP.SPRTELE_PIDM
and SP.SPRTELE_STATUS_IND IS NULL) "SC_Phone",
(select pp.GOREMAL_EMAIL_ADDRESS
from GENERAL.GOREMAL pp
where pp.GOREMAL_STATUS_IND ='A'
and AA.SARADAP_PIDM = pp.GOREMAL_PIDM
and pp.GOREMAL_EMAL_CODE ='HOME') "Email",
MJ.STVMAJR_DESC as "Major",
(select max(TT.SORTEST_TEST_SCORE) from SATURN.SORTEST TT where
TT.SORTEST_PIDM=AA.SARADAP_PIDM and TT.SORTEST_TESC_CODE ='APTS')"APTS",
(select max(TT.SORTEST_TEST_SCORE) from SATURN.SORTEST TT where
TT.SORTEST_PIDM=AA.SARADAP_PIDM and TT.SORTEST_TESC_CODE ='ARNK')"ARNK",
(select max(TT.SORTEST_TEST_SCORE) from SATURN.SORTEST TT where
TT.SORTEST_PIDM=AA.SARADAP_PIDM and TT.SORTEST_TESC_CODE ='RGPA')"RGPA",
(select max(TT.SORTEST_TEST_DATE) from SATURN.SORTEST TT where
TT.SORTEST_PIDM=AA.SARADAP_PIDM and TT.SORTEST_TESC_CODE ='RGPA')"RGPAdate",
(select max(TT.SORTEST_TEST_SCORE) from SATURN.SORTEST TT where
TT.SORTEST_PIDM=AA.SARADAP_PIDM and TT.SORTEST_TESC_CODE ='S01')+
(select max(TT.SORTEST_TEST_SCORE) from SATURN.SORTEST TT where
TT.SORTEST_PIDM=AA.SARADAP_PIDM and TT.SORTEST_TESC_CODE ='S02')"SATC",
(select max(TT.SORTEST_TEST_SCORE) from SATURN.SORTEST TT where
TT.SORTEST_PIDM=AA.SARADAP_PIDM and TT.SORTEST_TESC_CODE ='A05')"ACT",
SS.ACTC
from SATURN.SARADAP AA,
SATURN.SPRIDEN BB,
SATURN.STVSBGI FF,
SATURN.SOBSBGI LL,
SATURN.SORHSCH MM,
SATURN.SPBPERS CC,
SATURN.STVLGCY DD,
SATURN.STVMAJR MJ,
SATURN.SARAPPD EE,
(SELECT SS.SORTEST_PIDM, MAX(SS.SORTEST_TEST_SCORE) "SCORE", AA.SARADAP_PIDM,
CASE when SS.SORTEST_TEST_SCORE IS NULL AND SS.SORTEST_TESC_CODE = 'A05' THEN NULL
when SS.SORTEST_TEST_SCORE = '09' AND SS.SORTEST_TESC_CODE = 'A05' THEN '400'
when SS.SORTEST_TEST_SCORE = '10' AND SS.SORTEST_TESC_CODE = 'A05' THEN '500'
when SS.SORTEST_TEST_SCORE = '11' AND SS.SORTEST_TESC_CODE = 'A05' THEN '550'
when SS.SORTEST_TEST_SCORE = '12' AND SS.SORTEST_TESC_CODE = 'A05' THEN '590'
when SS.SORTEST_TEST_SCORE = '13' AND SS.SORTEST_TESC_CODE = 'A05' THEN '640'
when SS.SORTEST_TEST_SCORE = '14' AND SS.SORTEST_TESC_CODE = 'A05' THEN '690'
when SS.SORTEST_TEST_SCORE = '15' AND SS.SORTEST_TESC_CODE = 'A05' THEN '740'
when SS.SORTEST_TEST_SCORE = '16' AND SS.SORTEST_TESC_CODE = 'A05' THEN '790'
when SS.SORTEST_TEST_SCORE = '17' AND SS.SORTEST_TESC_CODE = 'A05' THEN '830'
when SS.SORTEST_TEST_SCORE = '18' AND SS.SORTEST_TESC_CODE = 'A05' THEN '870'
when SS.SORTEST_TEST_SCORE = '19' AND SS.SORTEST_TESC_CODE = 'A05' THEN '910'
when SS.SORTEST_TEST_SCORE = '20' AND SS.SORTEST_TESC_CODE = 'A05' THEN '950'
when SS.SORTEST_TEST_SCORE = '21' AND SS.SORTEST_TESC_CODE = 'A05' THEN '990'
when SS.SORTEST_TEST_SCORE = '22' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1030'
when SS.SORTEST_TEST_SCORE = '23' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1070'
when SS.SORTEST_TEST_SCORE = '24' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1110'
when SS.SORTEST_TEST_SCORE = '25' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1140'
when SS.SORTEST_TEST_SCORE = '26' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1180'
when SS.SORTEST_TEST_SCORE = '27' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1220'
when SS.SORTEST_TEST_SCORE = '28' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1260'
when SS.SORTEST_TEST_SCORE = '29' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1300'
when SS.SORTEST_TEST_SCORE = '30' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1340'
when SS.SORTEST_TEST_SCORE = '31' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1380'
when SS.SORTEST_TEST_SCORE = '32' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1420'
when SS.SORTEST_TEST_SCORE = '33' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1470'
when SS.SORTEST_TEST_SCORE = '34' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1520'
when SS.SORTEST_TEST_SCORE = '35' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1550'
when SS.SORTEST_TEST_SCORE = '36' AND SS.SORTEST_TESC_CODE = 'A05' THEN '1600'
ELSE NULL END FROM SATURN.SORTEST SS, SATURN.SARADAP AA WHERE
AA.SARADAP_PIDM=SS.SORTEST_PIDM
GROUP BY SS.SORTEST_PIDM, AA.SARADAP_PIDM, SS.SORTEST_TEST_SCORE,
SS.SORTEST_TESC_CODE) "ACTC"
where AA.SARADAP_TERM_CODE_ENTRY = '201409'
and AA.SARADAP_PIDM=BB.SPRIDEN_PIDM
and AA.SARADAP_PIDM=CC.SPBPERS_PIDM
and CC.SPBPERS_LGCY_CODE=DD.STVLGCY_CODE
and AA.SARADAP_PIDM=EE.SARAPPD_PIDM
and AA.SARADAP_PIDM=MM.SORHSCH_PIDM
and LL.SOBSBGI_SBGI_CODE = MM.SORHSCH_SBGI_CODE
and AA.SARADAP_MAJR_CODE_1 = MJ.STVMAJR_CODE
AND AA.SARADAP_STYP_CODE = 'N'
AND AA.SARADAP_COLL_CODE_1 = 'AS'
group by AA.SARADAP_TERM_CODE_ENTRY,
BB.SPRIDEN_ID,
BB.SPRIDEN_FIRST_NAME,
BB.SPRIDEN_LAST_NAME,
CC.SPBPERS_SEX,
CC.SPBPERS_ETHN_CDE,
AA.SARADAP_PIDM,
DD.STVLGCY_DESC,
CC.SPBPERS_CITZ_CODE,
AA.SARADAP_ADMT_CODE,
AA.SARADAP_STYP_CODE,
AA.SARADAP_APST_CODE,
AA.SARADAP_APST_DATE,
EE.SARAPPD_APDC_CODE,
EE.SARAPPD_APDC_DATE,
AA.SARADAP_RECR_CODE,
FF.STVSBGI_DESC,
LL.SOBSBGI_CITY,
LL.SOBSBGI_STAT_CODE,
MM.SORHSCH_CLASS_RANK,
MM.SORHSCH_CLASS_SIZE,
MJ.STVMAJR_DESC
)ZZ
)XX
Where xx.APTS >= '27'
and (xx.SATC >= '1340' or xx.ACT >='30')
Order by xx.LastName, xx.FirstName
答案 0 :(得分:3)
很难找到你庞大的SQL墙(请将其缩小到下一个最小的例子),但我猜这一行:
Select *,
应该是:
Select ZZ.*,
您通常不能在非限定*
之后选择列...例如。甚至以下失败:
SELECT *, dummy FROM DUAL;
虽然没关系:
SELECT d.*, dummy FROM DUAL d;