[20130723]ORACLE 12C Invisible Columns的补充.txt
http://connormcdonald.wordpress.com/2013/07/22/12c-invisible-columns/
正好看了以上链接,执行以上过程,可以调整显示顺序。记录一下。
SQL> create or replace
2 procedure fix_cols(p_tname varchar2, p_col_list varchar2) is
3 l_col_list varchar2(1000) := p_col_list||',';
4 type clist is table of varchar2(30)
5 index by pls_integer;
6 c clist;
7
8 this_col varchar2(30);
9 l_id int;
10 begin
11 while instr(l_col_list,',') > 1 loop
12 c(c.count+1) := substr(l_col_list,1,instr(l_col_list,',')-1);
13 l_col_list := substr(l_col_list,instr(l_col_list,',')+1);
14 dbms_output.put_line(c(c.count));
15 end loop;
16
17 for i in 1 .. c.count loop
18 loop
19 select column_name
20 into this_col
21 from user_tab_columns
22 where table_name = p_tname
23 and column_id = i;
24
25 exit when this_col = c(i);
26
27 execute immediate 'alter table '||p_tname||' modify '||this_col||' invisible';
28 execute immediate 'alter table '||p_tname||' modify '||this_col||' visible';
29 end loop;
30 end loop;
31 end;
32 /
SQL> exec fix_cols('T','A,B,C');
--实际上就是按照顺序执行invisible,在visible,这样就可以按照顺序显示。
时间: 2024-09-17 09:47:39