Search code examples
sqloracle-databasenvl

NVL function in Oracle


I want to select all the data from the table employee and make an inner join with an other table for example:

SELECT * FROM EMPLOYEE 
INNER JOIN Deparment ON Employee.Id_Department = Deparment.Deparment_Id 
    AND NVL('Mathematics', Deparment.Name);

When I execute that I get an error ORA-00920: Invalid relational operator, I think maybe the nvl() function is the problem here.


Solution

  • you need to add a relational operator like =, !=, < after NVL('Mathematics', Deparment.Name)
    as an example :

    AND NVL(Deparment.Name,'Mathematics')='Physics'