Select all cols in a table except for 2 explicitly specified cols without typing out the majority of the column names?
Date: Wed, 22 Jul 2009 10:01:39 -0700 (PDT)
In Oracle SQL (or any other dialect), if there an easy way to select all cols in a table except for 2 explicitly specified cols, without having to type the majority of the column names?
Example 1: Select all columns
from all_tables a;
Example 2: Pseudo SQL to select all columns but two in a table having many columns (e.g. 47 columns out of 49 columns for this example table in 10g):
select all columns except for MIN_EXTENTS and MAX_EXTENTS from all_tables a;
Is this a job for "SQL writing SQL", using PL/SQL and a limiting subquery like:
where owner = 'SYS'
and table_name = 'ALL_TABLES'
and column_name not in ('MIN_EXTENTS', 'MAX_EXTENTS');
... or is this a much simpler solution (one that doesn't involve manually copy-pasting 47 columns)?
Dana Received on Wed Jul 22 2009 - 12:01:39 CDT