I have a problem with NVL function.I can use my in clause properyl but when i add nvl it gives error.
My query like this:
SELECT ci.date,
SUM (cid.salary) amount, SUM (cid.slary_gross) gross_amount
FROM students ci,
orders cid
WHERE
ci.id IN NVL((select id from sysadm.students
where status = 'IN' AND student_id= 24514 ORDER BY id
FETCH FIRST 3 ROWS ONLY), ci.id )
My error: 01427. 00000 - "single-row subquery returns more than one row"
İf I delete nvl function and just write like below it is running.How can i use nvl with in clause?
ci.id IN (select id from sysadm.students where status = 'IN' AND student_id= 24514 ORDER BY id FETCH FIRST 3 ROWS ONLY)
I doubt the
id
isNULL
in the subquery. SO I would suggest:This checks if your id is in the list -- or that the list is empty.