Can someone tell me why the below code isnt working for Oracle SQL.
select distinct city from station where id%2=0;
The code is for printing city names which are not duplicates for even ID's. Any other way I can suffice the requirement?
Can someone tell me why the below code isnt working for Oracle SQL.
select distinct city from station where id%2=0;
The code is for printing city names which are not duplicates for even ID's. Any other way I can suffice the requirement?
if for % you mean the MODULUS operator used to return the remainder of a dividend divided by a divisor.
you should use MOD()
select distinct(city) from station where MOD(id,2)=0;
Oracle SQL has a MOD function to compute remainders.
select distinct(city) from station where MOD(id,2)=0;
Oracle SQL supports
mod(id,2)
Additionally, PL/SQL static expressions (not cursors) support
id mod 2
The unquoted % symbol is used for cursor attributes such as %notfound.