I am creating a lot of scripts, and sometimes to check that the tables are being updated as I need, I write on the fly several SELECT statements.
In SQL SERVER you can write something like:
SELECT Column1, *
FROM MY_TABLE
This is useful for visibility reasons, however that doesn't seem to work in ORACLE and I don't know how to achieve it, other than writing down all the Column Names manually.
How can you do this in oracle?
I know we shouldn't include a query like this in our production scripts, etc. I am just trying to use it on the fly while I am running my scripts in development. At different points I'm more interested to see the information of certain columns, in relation to the other ones, but I still want to see all the columns.
In short, it is used to convert a collection or pipelined function into a table that can be queried by a SELECT statement. Typically, the collection must be of a datatype that is defined at the database level (i.e. a datatype that was created by a create or replace type ... statement).
An asterisk (" * ") can be used to specify that the query should return all columns of the queried tables. SELECT is the most complex statement in SQL, with optional keywords and clauses that include: The FROM clause, which indicates the table(s) to retrieve data from.
The Oracle SELECT clause:After the Oracle SELECT keyword, specify the names of the columns that you would like to retrieve, separated by comma (,). You can specify as many columns as you want; you can even specify the same column more than once. The columns appear in the order selected.
For your question just use SELECT *. If you need all the columns there's no performance difference. Save this answer.
SELECT Column1, MY_TABLE.*
FROM MY_TABLE
Or if you give the table an alias:
SELECT Column1, T.*
FROM MY_TABLE T
Use an alias:
SELECT Column1, t.*
FROM MY_TABLE t;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With