* Beware of the issues with calinng PL/SQL function from SQL The requirements ---------------------- The restrictions ------------------- * Thou shall not change the database...No DML, DDL allowed in the function. SQL> create or replace function my_func_ return number as 2 begin 3 delete from t1_; 4 end; 5 / Function created. SQL> select my_func_ from dual; select my_func_ from dual * ERROR at line 1: ORA-14551: cannot perform a DML operation inside a query ORA-06512: at "JYANG.MY_FUNC_", line 3 SQL> SQL> create or replace function fun1_ return number as 2 begin 3 execute immediate 'create table tyu3(c1 number)'; 4 end; 5 / Function created. SQL> select fun1_ from dual; select fun1_ from dual * ERROR at line 1: ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML ORA-06512: at "JYANG.FUN1_", line 3 SQL>