CREATE OR REPLACE FUNCTION sql_excute(v_sql IN VARCHAR2)
RETURN VARCHAR2 IS
v_result VARCHAR2(1000);
BEGIN
IF v_sql IS NULL THEN
RETURN '';
ELSE
begin
execute immediate v_sql into v_result;
exception
when others then
v_result :='0';
end;
END IF;
RETURN(v_result);
END sql_excute
select TABLE_NAME , sql_excute('select count(*) from ' || t.TABLE_NAME) as count
from dba_tables t where t.OWNER='CREDITFW'