Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Boolean and SELECT

295352Sep 18 2002
I have a function that simulates if..then..else, and i would like to use this function in select. The test is a boolean var and Oracle cant accept.

How I resolve this problem?



thks
Sergio
---


SELECT IIf('A' in ('A','B','C') and 3 > 2 and 4 between 2 and 5,'TRUE','FALSE')
FROM DUAL;




-- Simula um IF...THEN...ELSE
--
CREATE OR REPLACE FUNCTION IIf(w_bool_exp IN BOOLEAN,
w_true_result IN VARCHAR2,
w_false_result IN VARCHAR2)
RETURN VARCHAR2
IS
BEGIN
IF w_bool_exp THEN
RETURN w_true_result;
ELSIF NOT w_bool_exp THEN
RETURN w_false_result;
ELSE
RETURN NULL;
END IF;
END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 16 2002
Added on Sep 18 2002
8 comments
9,823 views