Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Any way to use a wildcard to select all but one column?

Rick SilvaJan 4 2016 — edited Jan 8 2016

I have a large denormalized table with 108 columns.  I know I can "select * from" to display all of the column values, but is there some shorthand notation for selecting all columns except for the first one?

I know I can:

select * from table;

But if I don't want col1, I have to do this:

select  col2,

        col3,

        col4,

       ...

        col107,

        col108

from    table;

Is there some way to do something like this?:

select (* minus col1) from table;


The reason I ask is that I am writing some functionality to "clone" rows in the table.  I wrote an insert statement that looks like this:

insert into my_table (col2, col3, col4, ... col107, col108)

select col2, col3, col4, ... col107, col108

from my_table

where col1 = 123;

I don't insert col1 into the table because I have a trigger and sequence that will automatically populate it.

Is there some shorthand notation that I could use here to avoid having to type "col2, col3, col4, ... col107, col108"?

This post has been answered by Chris Hunt on Jan 4 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 5 2016
Added on Jan 4 2016
9 comments
4,340 views