PROCEDURE drop_object (type_in IN VARCHAR2, name_in IN VARCHAR2) IS /* The static cursor retrieving all matching objects */ CURSOR obj_cur IS SELECT object_name, object_type FROM user_objects WHERE object_name LIKE UPPER (name_in) AND object_type LIKE UPPER (type_in) ORDER BY object_name; /* Handle to the dynamic SQL cursor */ cursor_handle INTEGER; BEGIN /* For each matching object ... */ FOR obj_rec IN obj_cur LOOP /* Open a cursor for this next object */ cursor_handle := DBMS_SQL.OPEN_CURSOR; /* Construct the SQL statement and parse it in Version 7 mode. */ DBMS_SQL.PARSE (cursor_handle, 'DROP ' || obj_rec.object_type || ' ' || obj_rec.object_name, DBMS_SQL.V7); /* Close the cursor for this object */ DBMS_SQL.CLOSE_CURSOR (cursor_handle); END LOOP; END;