Oracle修改字段顺序和字段类型以及拼接字段,查看锁表

字段有数据,则类型不能直接renamesql

/*增长一个新字段sub_pol_code*/
alter table IPR_SUB_POLICY add sub_pol_code VARCHAR2(8);session

/*将原字段ORDER_SEQ数据更新到增长的字段sub_pol_code*/
update IPR_SUB_POLICY set sub_pol_code=trim(ORDER_SEQ);code

/*更新完,删除原字段ORDER_SEQ*/
alter table IPR_SUB_POLICY drop column ORDER_SEQ;it

将字段io

拼接为qwe-1table

update IPR_SUB_POLICY set sub_pol_code= CONCAT(CONCAT(pol_code,'-'),sub_pol_code) where sub_pol_id>=1818test

 

select * from sys.col$ where obj#=88368;
select * from all_objects where owner = 'PRODUCT' and object_name = 'IPR_SUB_POLICY' ;object

select obj#,col#,name from sys.col$ where obj#=88368;date

update sys.col$ set col#=7 where obj#=88368 and name='SUB_POL_CODE';
update sys.col$ set col#=3 where obj#=88368 and name='SUB_POL_NAME';
update sys.col$ set col#=4 where obj#=88368 and name='CREATE_DATE';
update sys.col$ set col#=5 where obj#=88368 and name='SALE_SERVE_OPTION';
update sys.col$ set col#=6 where obj#=88368 and name='APPLY_TYPE_CODE';select

[test@rhel675771 ~]$ sqlplus sys/Clic1234 as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on 星期三 8月 17 17:15:31 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> update sys.col$ set col#=3 where obj#=88368 and name='SUB_POL_CODE'
  2  
SQL> select obj#,col#,name from sys.col$ where obj#=88368;

      OBJ#       COL# NAME
---------- ---------- ------------------------------
     88368          1 SUB_POL_ID
     88368          2 POL_CODE
     88368          3 SUB_POL_NAME
     88368          4 CREATE_DATE
     88368          5 SALE_SERVE_OPTION
     88368          6 APPLY_TYPE_CODE
     88368          7 SUB_POL_CODE

7 rows selected.

SQL> update sys.col$ set col#=3 where obj#=88368 and name='SUB_POL_CODE';

1 row updated.

SQL> select obj#,col#,name from sys.col$ where obj#=88368;

      OBJ#       COL# NAME
---------- ---------- ------------------------------
     88368          1 SUB_POL_ID
     88368          2 POL_CODE
     88368          3 SUB_POL_NAME
     88368          4 CREATE_DATE
     88368          5 SALE_SERVE_OPTION
     88368          6 APPLY_TYPE_CODE
     88368          3 SUB_POL_CODE

7 rows selected.

SQL> update sys.col$ set col#=4 where obj#=88368 and name='SUB_POL_NAME';

1 row updated.

SQL> update sys.col$ set col#=5 where obj#=88368 and name='CREATE_DATE';

1 row updated.

SQL> update sys.col$ set col#=6 where obj#=88368 and name='SALE_SERVE_OPTION';

1 row updated.

SQL> update sys.col$ set col#=7 where obj#=88368 and name='APPLY_TYPE_CODE';    

1 row updated.

SQL> select obj#,col#,name from sys.col$ where obj#=88368;

      OBJ#       COL# NAME
---------- ---------- ------------------------------
     88368          1 SUB_POL_ID
     88368          2 POL_CODE
     88368          4 SUB_POL_NAME
     88368          5 CREATE_DATE
     88368          6 SALE_SERVE_OPTION
     88368          7 APPLY_TYPE_CODE
     88368          3 SUB_POL_CODE

7 rows selected.

SQL> commit;

Commit complete.

 

select *  from v$locked_object x , dba_objects m where x.OBJECT_ID=m.OBJECT_ID         select * from v$session where sid=3428        alter system kill session '3428,3249'--sid ,serial#

相关文章
相关标签/搜索