EXES
WHERE TABLE_ID=:id FOR UPDATE;
BEGIN
DELETE FROM SYS_TABLES WHERE ID=:id;
DELETE FROM SYS_COLUMNS WHERE TABLE_ID=:id;
OPEN idx;
WHILE 1 = 1 LOOP
  FETCH idx INTO iid;
  IF (SQL % NOTFOUND) THEN EXIT; END IF;
  DELETE FROM SYS_INDEXES WHERE CURRENT OF idx;
  DELETE FROM SYS_FIELDS WHERE INDEX_ID=iid;
END LOOP;
CLOSE idx;
END;
