我有一個甲骨文的SQL查詢的這個部分(其它更多的上面是不適用的問題) ...奇怪無效標識符錯誤的Oracle SQL
authorw as (
select a.id, (sum(p.w)) "theWeightOfTheAuthor"
from ac a, pc p, authorpublication ap
where a.id = ap.aid and ap.pid = p.id
group by a.id)
select authorCount.id "ID", auth.name "NAME", authorCount.c "TOTAL_NUMBER_OF_PUBS",
athw.theWeightOfTheAuthor "W_SCORE",
(authorCount.C/athw.theWeightOfTheAuthor) "MULT"
from ac authorCount, authorw athw, Author auth
where authorCount.id = athw.id and authorCount.id = auth.id
order by TOTAL_NUMBER_OF_PUBS desc;
在那裏我收到一個錯誤:
ORA-00904: "ATHW"."THEWEIGHTOFTHEAUTHOR": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 404 Column: 22
線404是從最後一行第四:
(authorCount.C/athw.theWeightOfTheAuthor) "MULT"
注:我可以訪問athw.id
就好了,如果我執行到authorw
創建,表格會按預期正確打印theWeightOfTheAuthor
列。是什麼賦予了?
因爲'theWeightOfTheAuthor'是一個不同的名稱,所以''theWeightOfTheAuthor'''。有關詳細信息,請參閱手冊:https://docs.oracle.com/database/121/SQLRF/sql_elements008.htm#SQLRF00223 –