Sql – NVL and relational operator in where clause of db query

oraclesql

I am learning SQL and using Oracle 11. I am working with a criminal database and trying to get the criminals who have unpaid fee's. My query is as follows

select first, last, charge_id, (fine_amount + court_fee) as "Total Amount Owed", NVL(amount_paid, null), (fine_amount + court_fee - amount_paid) as "Amount Owed", pay_due_date 
from crime_charges cc, criminals c, crimes
where crimes.crime_id = cc.crime_id and c.criminal_id = crimes.criminal_id and (NVL(fine_amount, 0) + NVL(court_fee, 0)) – NVL(amount_paid, 0 ) > 0;

There are null values in the database for amount_paid and fine_amount and court_fee. Im trying to filter out there criminals who dont owe anything atm ie
(fine_amount + court_fee) – amount_paid> 0

i keep getting an error saying
ORA-00920: invalid relational operator
00920. 00000 – "invalid relational operator"
*Cause:
*Action:
Error at Line: 43 Column: 122

I haven't been able to get NVL to work in the where clause at all. I have seen examples of where clauses using NVL but i dont see how they differ from my query.

Example:

SELECT fname, lname, manager_emp_id

FROM employee

WHERE NVL(manager_emp_id, -999) != 7698;

Best Answer

You used instead of -.

Wait, what?

select dump('–') from dual;
Typ=96 Len=3: 239,191,189

select dump('-') from dual;
Typ=96 Len=1: 45