Home » SQL & PL/SQL » SQL & PL/SQL » ORA-00904: "CNT": invalid identifier error (Oralce 11g)
ORA-00904: "CNT": invalid identifier error [message #611196] Sat, 29 March 2014 07:17 Go to next message
na.dharma@gmail.com
Messages: 82
Registered: May 2008
Location: bangalore
Member

Hi All,

I am getting below error, please help me resolve this.

select count(*) over(partition by iso_2_country_code) As Cnt from sx_country_limits where cnt>1

ORA-00904: "CNT": invalid identifier

Note : iso_2_country_code field is varchar2 datatype.
Re: ORA-00904: "CNT": invalid identifier error [message #611197 is a reply to message #611196] Sat, 29 March 2014 07:25 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

1/ You cannot use an alias in the WHERE clause.
2/ You cannot use an analytic function in the WHERE because the analytic function is computed AFTER it
3/
select * from (select count(*) over(partition by iso_2_country_code) As Cnt from sx_country_limits) where cnt>1
Which is, of course, a meaningless query

Re: ORA-00904: "CNT": invalid identifier error [message #611198 is a reply to message #611197] Sat, 29 March 2014 07:28 Go to previous message
na.dharma@gmail.com
Messages: 82
Registered: May 2008
Location: bangalore
Member

thank you very much michel.
Previous Topic: How to handle error in 5th counting on cursor
Next Topic: How to store GMT timestamp in Database from SQL Developer import excelsheet
Goto Forum:
  


Current Time: Fri Apr 26 07:37:41 CDT 2024