简体   繁体   中英

Function in Oracle SQL where clause

I have a query like this:

SELECT * 
FROM employees emp 
WHERE emp.loc = 'US' 
  AND usr.fnctn('emp_sal', :sal1, :sal2);

This query causes an error:

ORA-00920: invalid RELATIONAL OPERATOR

My function just returns the highest and the lowest sal in employees table

A function returns a value.

In the where clause you need to compare that return value with something, eg

SELECT * 
FROM employees emp 
WHERE emp.loc = 'US' 
AND usr.fnctn('emp_sal', :sal1, :sal2) = 42;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM