查找的相关结果:
SQL ID: 60uw2vh6q9vn2
Plan Hash: 0
insert intocol$(obj#,name,intcol#,segcol#,type#,length,precision#,scale,
null$,offset,fixedstorage,segcollength,deflength,default$,col#,property,
charsetid,charsetform,spare1,spare2,spare3)
values
(:1,:2,:3,:4,:5,:6,decode(:5,182/*DTYIYM*/,:7,183/*DTYIDS*/,:7,decode(:7,0,
null,:7)),decode(:5,2,decode(:8,-127/*MAXSB1MINAL*/,null,:8),178,:8,179,:8,
180,:8,181,:8,182,:8,183,:8,231,:8,null),:9,0,:10,:11,decode(:12,0,null,:12)
,:13,:14,:15,:16,:17,:18,:19,:20)
SQL ID: dbcjnkpkvgy5w
Plan Hash: 511615611
update col$ setname=:3,segcol#=:4,type#=:5,length=:6,precision#=decode(:5,
182/*DTYIYM*/,:7,183/*DTYIDS*/,:7,decode(:7,0,null,:7)),scale=decode(:5,2,
decode(:8,-127/*MAXSB1MINAL*/,null,:8),178,:8,179,:8,180,:8,181,:8,182,:8,
183,:8,231,:8,null),null$=:9,fixedstorage=:10,segcollength=:11,col#=:12,
property=:13,charsetid=:14,charsetform=:15,spare1=:16,spare2=:17,spare3=:18,
deflength=decode(:19,0,null,:19),default$=:20
where obj#=:1 and intcol#=:2
SQL ID: cqrnq6vsqgzcv
Plan Hash: 0
insert into ecol$ values (:1, :2, :3)
SQL ID: aa35g82k7dkd9
Plan Hash: 3081038021
select binaryDefVal, length(binaryDefVal)
from ecol$ where tabobj# = :1 and colnum =:2
--注意这里ecol$和col$ 都被更新了。
2.3 测试ecol$ 和col$ 区别:
查看sys.ecol$
SQL> select * from sys.ecol$;
TABOBJ# COLNUM BINARYDEFVAL
---------- ---------------------------------------
83210 3 3133383838383838383838
SQL> desc ecol$;
Name Null Type
------------------------------------------------- -------
TABOBJ# NUMBER
COLNUM NUMBER
BINARYDEFVAL BLOB
我可以使用如下SQL 查看对应的值:
SQL> select utl_raw.cast_to_varchar2(dbms_lob.substr(BINARYDEFVAL)) AS TEL from sys.ecol$;
TEL
--------------------------------------------------------------------------------
13888888888
这里返回的是我们之前的设置,关于LOB的更多内容参考我的Blog:
ORACLE LOB 大对象处理 http://www.2cto.com/database/201202/118146. html
通过sys.col$就看的比较简单了:
SQL> select obj#,name,default$ fromsys.col$ where obj#=83210;
OBJ# NAME DEFAULT$
---------- ----------------------------------------------------
83210 ID
83210 NAME
83210 TEL '13888888888'
现在我们来修改这个字段的默认值:
SQL> alter table t1 modify tel default '13899999999';
Table altered.
SQL> select * from t1;
ID NAME TEL
---------- ----------------------------------------
1 dave 13888888888
2 anqing 13888888888
3 huaining 13888888888
SQL> insert into t1(id,name)values(4,'hefei');
1 row created.
SQL> select * from t1;
ID NAME TEL
---------- ----------------------------------------
1 dave 13888888888
2 anqing 13888888888
3 huaining 13888888888
4 hefei 13899999999
SQL> commit;
Commit complete.
再次查看ecol$ 和col$ 中对应的记录:
SQL> select obj#,name,defaul