I have a table which consist of anonymous block in the column rule, which needs to be executed from procedure.
Here is the sample data which looks like the real scenario.
Table emp:
create table emp (id int,name varchar2(20)); Data:
insert into emp values(1,'Jack'); insert into emp values(2,'John'); insert into emp values(3,'Jams'); Table ano:
create table ano(id int,rule varchar2(4000)); Data:
insert into ano values(1,'declare v_cnt number; begin select count(1) into v_cnt from emp where id = :1; if(v_cnt>1) then :2 := ''true''; else :2 := ''false''; end if; end;'); Procedure:
create procedure pr_ano(p_emp emp) IS DECLARE v_out boolean; BEGIN execute immediate p_emp.rule using 1,v_out; dbms_output.put_line(v_out); END; Procedure call:
pr_ano(emp); Getting an error Unkown Command;