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 /
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-766893/ ,如需转载,请注明出处,否则将追究法律责任。