How to exclude a column from SELECT query?

后端 未结 5 1276
借酒劲吻你
借酒劲吻你 2020-12-03 23:01

I have 100 columns in a table and I want to list 99 columns except a particular one.

How to exclude that columns name?

5条回答
  •  暖寄归人
    2020-12-03 23:34

    You cannot.

    Theoretically, you might involve dynamic sql here - some procedure will loop through all columns of your table (like, all_tabs_columns dictionary view in Oracle lists all columns of all tables), and form up you a query of select c1, c2 c3 ... c99 from tab, but I strongly discourage you of doing this. Will save you several lines of code, but make it hard to maintain. :)

提交回复
热议问题