Passing table name dynamically
*******************
declare
tab_name varchar2(30) := NULL ;
cursor c1 is select name
from dba_PART_KEY_COLUMNS
where owner='CARSDM'
and object_type='TABLE'
and column_name='WEEK_ID';
begin
open c1;
loop
fetch c1 into tab_name;
exit when c1%notfound;
tab_name := 'CARSDM.'||tab_name ;
select max(WEEK_ID) into YR_WEEK from tab_name ;
dbms_output.put_line(' table name '|| tab_name );