Simulate a where clause on a “long” type column from SQLPlus

As a DBA you sometimes have to take time to look for tricks to accomplish tasks that seem simple at first glance. A few days ago, I was asked to identify tables that had sequences prefixed by the schema name as a default value in the columns. You may think: it’s an easy task, just filter on the “data_default” column of the “dba_tab_columns” view, but unfortunately it’s not that simple using SQLPlus. The “data_default” column is in “longdatatype, so you cannot include it directly in the “where” clause of a query.

Continue reading “Simulate a where clause on a “long” type column from SQLPlus”