What's wrong with this function please. I'm getting ORA-00903: invalid table name, ORA-06512: at "CHE.F_UNAPP_COUNT10", line 24
CREATE OR REPLACE function CHE.f_unapp_count( parm_file in varchar2, parm_dist in varchar2)
return number is Result number(6);
the_sql varchar2(100);
the_sql3 varchar2(100);
where_clause varchar2(100);
the_sql:= 'select count(*) from ' || parm_file || ' into Result';
dbms_output.put_line('the_sql= '||the_sql);
where_clause := ' WHERE dist = '''||parm_dist||'''';
dbms_output.put_line('where_clause= '||where_clause);
the_sql3:=' and dropped_date is null and dist_approved not in (''X'',''Y'',''y'')';
dbms_output.put_line('the_sql3= '||the_sql3);
execute immediate the_sql || where_clause || the_sql3;
return(Result);