Hi guys,
just got asked this question by a delphi programmer - apparently assignments to variables can be made in a similar way to the following:
v_assignee := <boolean statement> : <result if true> : <result if false>
or basically what an nvl would do if it assessed trueness rather than nullness.
I've been using Oracle for quite a while and don't know of any such function (what's wrong with a case or if statement?) but I thought I'd ask the question anyway - does such a thing exist in Oracle?
i.e. :
declare
v_assignee number;
function assess (v_statement in boolean
,v_val1 in number
,v_val2 in number)
return number
is
begin
if v_statement then
return v_val1;
else
return v_val2;
end if;
end;
begin
-- v_test :=
v_assignee := assess(1+1=2,10,20);
dbms_output.put_line(v_assignee);
end;