Hi,
    look up uses of execute immediate

create your own dynamic query with table name taken from parameter v_table and column name essentially you create string with query v_sql := 'SELECT * FROM ' || v_table || ' WHERE ' || v_col || ' ..... ';

then its something like EXECUTE IMMEDIATE v_sql INTO result; (I've improvised syntax - google up correct one)

    regards

            hoppo

On 20. 12. 2011 10:33, Mohammed Iyad wrote:


Hi friends,

I collect a large amount of data every day, from various tables,

I like to create a function has two in parameter (table name & date field) and it's out parameter should be row count

as the follow:

create or replace function TABLE_ROW_COUNT (v_table IN VARCHAR2, v_date_col IN varchar2) return number is
  Result number;
begin
  v_count NUMBER;
  BEGIN
   SELECT COUNT(*)
   INTO Result
   FROM v_table
   WHERE v_date_col >= trunc(SYSDATE-1);
  return(Result);
end ;


the problem it doesn't accept table name as variable,

is their any other way around it,

many thanks in advance,
Best Regards,
Iyad
--
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

--
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

Reply via email to