plsql - Why can't I use Boolean data type with Execute Immediate? -


declare dyn_stmt varchar2(200); b1 boolean; function f(x integer) return boolean begin return false; end f; begin dyn_stmt := 'begin :b := f(5); end;'; execute immediate dyn_stmt using out b1; --line 9 b1:=f(5);   --line 10 end; 

commenting line 10 throws error whereas commenting line 9 works fine. why ? according error "expressions have of sql types" , afaik pl/sql supports boolean data type. then, what's problem here ?

as per oracle documentation:

this applies dynamic pl/sql (and sql too):

at run time, bind arguments replace corresponding placeholders in dynamic string. every placeholder must associated bind argument in using clause and/or returning clause. can use numeric, character, , string literals bind arguments, cannot use boolean literals (true, false, , null). pass nulls dynamic string, must use workaround. see "passing nulls dynamic sql".

this not apply dynamic pl/sql (only sql), continuing completeness:

dynamic sql supports sql datatypes. example, define variables , bind arguments can collections, lobs, instances of object type, , refs. dynamic sql not support pl/sql-specific types. example, define variables , bind arguments cannot booleans or index-by tables. exception pl/sql record can appear in clause.