I think your looking for DBMS_METADATA.GET_DDL which was introduced in 9i

HTH