How to select multiple columns between columns in Oracle SQL


A question that was asked among a few developers, now deferred to DBA experts:

Is there a way to select multiple columns within a table instead of SELECT'ing columns piecemeal? For example, let's say example table contains 26 columns respectively titled by letters (e.g. A, B, C, etc.). Suppose I would like to retrieve all rows from columns H, I, J, K, L, M, N, O, P- is there a more efficient way to begin the SELECT statement of the following query?

SELECT H, I, J, K, L, M, N, O, P FROM table;

Perhaps something like so?


Thank you!

Best Answer

This is a crazy idea and would makes future maintenance really tricky.

It is not possible to guarantee that column order will never change. There are plenty of situations where column order changes could potentially be beneficial. It may happen accidentally (update the wrong database) or it may be done for performance reasons (e.g. moving mostly NULL columns to the end).

Even if it is possible - don't do it.