Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Convert Boolean
Is there a package function or other method to convert BOOLEAN values to something else, e.g. numeric within a query?
I've checked the built-in packages with no luck (though maybe I missed something), then tried my own function, which is below:
CREATE OR REPLACE
FUNCTION test_conv (p_boolean IN BOOLEAN)
RETURN NUMBER
IS
v_value NUMBER DEFAULT 0;
BEGIN
IF p_boolean
THEN
v_value := 1;
END IF;
RETURN v_value;
END;
/
This works fine in an anonymous SQL block, but no luck in a query. The error message I get is:
ORA-06552: PL/SQL: Statement ignored ORA-06553: PLS-382: expression is of wrong type
Any thoughts would be much appreciated. Received on Tue Apr 17 2001 - 04:40:18 CDT