SELECT Column_Name, Data_Type, Data_Length, Nullable, AD_Table_ID, uc.DATA_PRECISION, uc.DATA_SCALE, DATA_DEFAULT, Table_Name, t.EntityType FROM User_Tab_Columns uc, AD_Table t WHERE uc.Table_Name=UPPER(t.TableName) AND NOT EXISTS ( SELECT * FROM AD_Table t, AD_Column c WHERE t.AD_Table_ID=c.AD_Table_ID AND uc.Table_Name=UPPER(t.TableName) AND uc.Column_Name=UPPER(c.ColumnName) ) AND(v_Record_ID=t.AD_Table_ID OR v_Record_ID IS NULL) ORDER BY uc.COLUMN_ID