create or replace procedure cnav_scrub_table_lock IS v_cursor number; v_command varchar2(2000); v_rows number; BEGIN v_cursor := DBMS_SQL.OPEN_CURSOR; v_command := 'update table_lock set unlock_date=sysdate,'; v_command := v_command || 'last_modified_by=5772,last_modified_date=sysdate'; v_command := v_command || ' where months_between(sysdate,lock_date)>delta_lock_time/44640'; v_command := v_command || ' and unlock_date is null'; DBMS_SQL.PARSE(v_cursor,v_command,DBMS_SQL.V7); v_rows := DBMS_SQL.EXECUTE(v_cursor); DBMS_SQL.CLOSE_CURSOR(v_cursor); END cnav_scrub_table_lock; / show errors; grant execute on cnav_scrub_table_lock to public;