Is it possible, in PLSQL, to select all of the fields in a table except for 1 or 2, without having to specify the fields you want?
Example, the employee table has the fields:
Is it still possible to write a query similar to
select * from employee
while leaving the field hobbies
without with having to write something like this?
select id, firstname, lastname from employee
The SQL EXCEPT operator is used to return all rows in the first SELECT statement that are not returned by the second SELECT statement. Each SELECT statement will define a dataset. The EXCEPT operator will retrieve all records from the first dataset and then remove from the results all records from the second dataset.
No - you either get all fields (*
) OR specify the fields you want.
If you want to avoid the writer's cramp, you can use SQL Developer and have it generate the column list for you:
select column_name||',' from all_tab_columns where table_name = 'YourTableName'
And then just take out the one or two columns that you don't want.
You can also use
SELECT listagg(column_name, ',') within group (order by column_name) columns FROM all_tab_columns WHERE table_name = 'TABLE_NAME' GROUP BY table_name;
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