Home > database >  Oracle query for hidden columns
Oracle query for hidden columns

Time:09-25

Great god, the oracle of the query time, if there are 80 columns field, but only need to check the seventy-five columns, and don't want to get the seventy-five column, a column of a column to write, have what good method?

CodePudding user response:

The 75 columns to view, the select * from v directly next time

CodePudding user response:

Select (select column_name from dba_tab_columns where table_name=t1 and column_name not in (field) you don't) from t1
Into a dynamic SQL

CodePudding user response:

The select wm_concat (column_name) from user_tab_cols where table_name='A1'
Spell out the field, and then you don't delete,
If the query is very frequent, use method, 1/f, create the corresponding view

CodePudding user response:

reference jdsnhan reply: 3/f
select wm_concat (column_name) from user_tab_cols where table_name='A1'
Spell out the field, and then you don't delete,
If the query is very frequent, use 1/f, the method of creating the corresponding view


To put it bluntly, this is lazy;

CodePudding user response:

references 4 floor selling fruit net reply:
Quote: reference jdsnhan reply: 3/f

The select wm_concat (column_name) from user_tab_cols where table_name='A1'
Spell out the field, and then you don't delete,
If the query is very frequent, use 1/f, the method of creating the corresponding view


To put it bluntly, this is lazy;
seventy a write a bored

CodePudding user response:

reference sound honest reply 2 floor:
select (select column_name from dba_tab_columns where table_name=t1 and column_name not in (field) you don't) from t1
It is ok to change dynamic SQL
single subquery return multiple rows

CodePudding user response:

In PLSQL, very simple, drag the table fields under the folder into the SQL is OK, and post,

CodePudding user response:

refer to 6th floor qq_38532397 response:
Quote: refer to the second floor solid honest reply:
select (select column_name from dba_tab_columns where table_name=t1 and column_name not in (field) you don't) from t1
It is ok to change dynamic SQL
single subquery return multiple rows

Try this
 
DECLARE
V_SQL VARCHAR (200);
The BEGIN
The SELECT LISTAGG (COLUMN_NAME, ', ') WITHIN GROUP (ORDER BY COLUMN_ID) INTO V_SQL FROM DBA_TAB_COLUMNS WHERE TABLE_NAME='T2' AND COLUMN_NAME NOT IN (' NAME ');
V_SQL:='SELECT' | | V_SQL | | 'FROM T2';
DBMS_OUTPUT. PUT_LINE (V_SQL);
- the EXECUTE IMMEDIATE V_SQL;
END;

  • Related