Bool support Oracle SQL Bool support Oracle SQL oracle oracle

Bool support Oracle SQL


You can write your own wrapper like this:

CREATE OR REPLACE FUNCTION my_bool_to_str(f varchar2) RETURN VARCHAR2 IS  b varchar2(2);BEGIN  EXECUTE IMMEDIATE 'declare bl boolean; begin bl := ' || f ||                    '; if bl then :1 := ''y''; else :1 := ''n''; end if; end;'    using out b;  return b;END;

Then you can call it like this:

SELECT part_no,       my_bool_to_str('stock_pkg.is_in_stock('|| part_no|| ')') in_stockFROM   parts_table

The difference from your wrapper is that it gets a varchar as input and not a boolean which the SQL engine doesn't recognize