2014-02-28 64 views
0

我是oracle sql中的初學者。我的腳本中有一個錯誤。我不知道什麼是錯的。我檢查了可能會導致錯誤的一切。請幫我..sql oracle中的標識符無效

這裏的腳本:

insert into antifraud(case_number,monitored_date,trigger1,trigger2,contract_number,description) 
select a.col1 as case_number, a.col2 as monitored_date 
    ,a.col3 as trigger1, a.col4 as trigger2 
    ,a.col15 as contract_number, a.col6 as description 
from (
select length(t.col2),(row_number() over (order by id)) as ord,t.* 
from app_account.params p 
inner join app_account.import_temp t on p.guid=t.reference 
order by t.id 
) a 
left join antifraud et 
on a.contract_number=et.contract_number 
and a.trigger1=et.trigger1 
and a.trigger2=et.trigger2 
and a.monitored_date=et.monitored_date 
where a.ord>3 
and et.contract_number is null; 

錯誤:

SQL Error: ORA-00904: "A"."MONITORED_DATE": invalid identifier 
00904. 00000 - "%s: invalid identifier" 

回答

1
and a.monitored_date=et.monitored_date 

應該

and a.col2=et.monitored_date 
+0

他提到'a.col2爲monitored_date' –

+2

數據過濾後應用@NagarajS別名環和最後的'SELECT'ion。它不能在'WHERE'子句中使用,除非在外部查詢中引用了別名列。所以,如Jeff所說,它必須是'a.col2' –