Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-00920: - Invalid relational operator error

User_3YG1KApr 14 2022

Hi , I have code like below :
Create Table a_2 ( c_id Number, c_name Varchar2(30));
Insert Into a_2 Values(1,'aaaaa');
Insert Into a_2 Values(2,'bbbb');
Insert Into a_2 Values(3,'cccc');
Insert Into a_2 Values(4,'dddd');
commit;
Select * From a_2;
Insert Into a_2 Values(4,'dddd');
------> now the purpose is to Delete duplicate records
Select Max(Rowid), c_id From a_2 Group By c_id Order By c_id Asc;
using the above query as subquery in DELETE using ROWID,
Delete From a_2
Where (Rowid,c_id) Not In (Select Max(Rowid),c_id From a_2
Group By c_id order By c_id Asc);
Problem is ----> when i execute the beloew query alone,
Select Max(Rowid),c_id From a_2 Group By c_id Order By c_id Asc , it is fine, there is no error bcoz of adding ASC at the end.
------> but , if i put same query in DELETE , i get the error, ''ORA-00920: invalid relational operator"
May i know where i am going wrong ?

Thanks for the reply.

Comments
Post Details
Added on Apr 14 2022
8 comments
6,959 views