I have a function that has three If / Then statements before opening the cursor. If / Then statements validate before the cursor opens.
I would like to add another If / Then check, however, this is a little more complicated than the others. Below is a sample, and I have a block that I would like to add:
begin if not procedure.validation_function (<variable>, <condition>=TRUE) then return variable2; end if; /* if not exists ( SELECT 'x' FROM table1 WHERE table1_id = variable1_id AND trunc(sysdate) < trunc(table1_date + 60) ) then return variable2; end if; */ open cursor(<argument>); fetch cursor into <variable>; close cursor; return <variable>; end;
My problem is that I came from the T-SQL world and I am in PL / SQL, if the command does not exist, it does not work. Is there a way that I can, from within a function, have an If NO_DATA_FOUND statement where I use SELECT?
Is there a way to insert another function into it, so I can:
begin SELECT .... FROM .... WHERE .... if NO_DATA_FOUND then return variable2; end if; end;
source share