简体   繁体   中英

Oracle | Select * besides <column_name>

How to select all columns from the table besides two or three? I work with a lot of tables with more than 50 columns, so I can not list of column name...

I hope that it works, but it doesn't

SELECT(
SELECT column_name FROM all_tab_columns
WHERE table_name = <table_name>
AND column_name NOT IT (<columns_name>)
)
from <table_name>;

Could you help me please?

您可以通过 pl/sql 过程动态构造查询,然后使用“立即执行”运行它

I found some workaround (because PL/SQL to hard for simple select):

CREAT TABLE <tmp> AS SELECT * FROM <table_name>;
ALTER TALBE <tmp> DROP COLUMN <column_name>;
SELECT * FROM <tmp>;
DROP TALBE <tmp>;

It will be useful to simple query... But for development PL/SQL will be more useful (universally, optimized for server, etc).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM