4

Is it possibile in PL/SQL function something like

IF xVar IN (SELECT yVar
            FROM....)
THEN...

this? Thank you

sqlab
  • 6,412
  • 1
  • 14
  • 29
ro.nin
  • 121
  • 5
  • 13

2 Answers2

3

No, you will probably have to so something like

select count(*) 
into foo 
from blah
where yVar = xVar

if foo > 0 then ...

Or you could make a function that returns boolean if this is something you'd use often

Joel
  • 196
  • 1
  • 6
0

You can use FOR-IN with your implicit cursor. I know only IF-THEN-ELSE operator with IF expression.

Vlad Dekhanov
  • 1,066
  • 1
  • 13
  • 27